You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ta...@apache.org on 2024/08/23 07:09:30 UTC
(iotdb) branch master updated: [region migration] Enable SchemaRegion write retry when migrating region concurrently (#13261)
This is an automated email from the ASF dual-hosted git repository.
tanxinyu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/master by this push:
new a1e6fab0cdf [region migration] Enable SchemaRegion write retry when migrating region concurrently (#13261)
a1e6fab0cdf is described below
commit a1e6fab0cdf446640a212b3a27820d7041d114d0
Author: Xiangpeng Hu <65...@users.noreply.github.com>
AuthorDate: Fri Aug 23 15:09:24 2024 +0800
[region migration] Enable SchemaRegion write retry when migrating region concurrently (#13261)
---
.../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 76db013a87b..7f5e341522c 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;
@@ -178,10 +179,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);
}
}
@@ -241,7 +243,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();
@@ -253,10 +255,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();
}