This is an automated email from the ASF dual-hosted git repository.
tanxinyu pushed a commit to branch rc/1.3.3
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/rc/1.3.3 by this push:
new e33d18e0102 [region migration] Enable SchemaRegion write retry when
migrating region concurrently (#13261) (#13288)
e33d18e0102 is described below
commit e33d18e0102eb1c326ed056cdff1fb3f93f9c662
Author: Xiangpeng Hu <[email protected]>
AuthorDate: Mon Aug 26 10:09:03 2024 +0800
[region migration] Enable SchemaRegion write retry when migrating region
concurrently (#13261) (#13288)
---
.../execution/executor/RegionWriteExecutor.java | 21 ++++++++++++---------
1 file changed, 12 insertions(+), 9 deletions(-)
diff --git
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/executor/RegionWriteExecutor.java
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/executor/RegionWriteExecutor.java
index fd0411994ac..8e67af5f60c 100644
---
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/executor/RegionWriteExecutor.java
+++
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/executor/RegionWriteExecutor.java
@@ -32,6 +32,7 @@ import org.apache.iotdb.commons.utils.TestOnly;
import org.apache.iotdb.consensus.ConsensusFactory;
import org.apache.iotdb.consensus.IConsensus;
import org.apache.iotdb.consensus.exception.ConsensusException;
+import org.apache.iotdb.consensus.exception.ConsensusGroupNotExistException;
import org.apache.iotdb.db.conf.IoTDBConfig;
import org.apache.iotdb.db.conf.IoTDBDescriptor;
import org.apache.iotdb.db.consensus.DataRegionConsensusImpl;
@@ -177,10 +178,11 @@ public class RegionWriteExecutor {
status);
} catch (ConsensusException e) {
LOGGER.warn("Failed in the write API executing the consensus layer due
to: ", e);
- return RegionExecutionResult.create(
- false,
- e.toString(),
- RpcUtils.getStatus(TSStatusCode.EXECUTE_STATEMENT_ERROR,
e.getMessage()));
+ TSStatus status =
RpcUtils.getStatus(TSStatusCode.EXECUTE_STATEMENT_ERROR, e.getMessage());
+ if (e instanceof ConsensusGroupNotExistException) {
+
status.setCode(TSStatusCode.NO_AVAILABLE_REGION_GROUP.getStatusCode());
+ }
+ return RegionExecutionResult.create(false, e.toString(), status);
}
}
@@ -234,7 +236,7 @@ public class RegionWriteExecutor {
if (context.getRegionWriteValidationRWLock() == null) {
String message = "Failed to get the lock of the region because the
region is not existed.";
return RegionExecutionResult.create(
- false, message,
RpcUtils.getStatus(TSStatusCode.WRITE_PROCESS_ERROR, message));
+ false, message,
RpcUtils.getStatus(TSStatusCode.NO_AVAILABLE_REGION_GROUP, message));
}
context.getRegionWriteValidationRWLock().readLock().lock();
@@ -246,10 +248,11 @@ public class RegionWriteExecutor {
status);
} catch (ConsensusException e) {
LOGGER.warn("Failed in the write API executing the consensus layer due
to: ", e);
- return RegionExecutionResult.create(
- false,
- e.toString(),
- RpcUtils.getStatus(TSStatusCode.WRITE_PROCESS_ERROR,
e.toString()));
+ TSStatus status = RpcUtils.getStatus(TSStatusCode.WRITE_PROCESS_ERROR,
e.toString());
+ if (e instanceof ConsensusGroupNotExistException) {
+
status.setCode(TSStatusCode.NO_AVAILABLE_REGION_GROUP.getStatusCode());
+ }
+ return RegionExecutionResult.create(false, e.toString(), status);
} finally {
context.getRegionWriteValidationRWLock().readLock().unlock();
}