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 ce5cfed4cf7 Update DataNodeRegionManager.java (#15076)
ce5cfed4cf7 is described below
commit ce5cfed4cf76458ba9f9d07f325447081144ae0e
Author: Caideyipi <[email protected]>
AuthorDate: Thu Mar 13 11:32:54 2025 +0800
Update DataNodeRegionManager.java (#15076)
---
.../execution/executor/RegionWriteExecutor.java | 18 +++++++++++++++---
1 file changed, 15 insertions(+), 3 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 e9fac5c1d32..fc3013b6240 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
@@ -88,6 +88,7 @@ import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
+import java.util.Objects;
import java.util.concurrent.locks.ReentrantReadWriteLock;
public class RegionWriteExecutor {
@@ -147,9 +148,9 @@ public class RegionWriteExecutor {
}
@SuppressWarnings("squid:S1181")
- public RegionExecutionResult execute(ConsensusGroupId groupId, PlanNode
planNode) {
+ public RegionExecutionResult execute(final ConsensusGroupId groupId, final
PlanNode planNode) {
try {
- ReentrantReadWriteLock lock = regionManager.getRegionLock(groupId);
+ final ReentrantReadWriteLock lock = regionManager.getRegionLock(groupId);
if (lock == null) {
return RegionExecutionResult.create(
false,
@@ -157,7 +158,18 @@ public class RegionWriteExecutor {
RpcUtils.getStatus(TSStatusCode.NO_AVAILABLE_REGION_GROUP));
}
return planNode.accept(executionVisitor, new
WritePlanNodeExecutionContext(groupId, lock));
- } catch (Throwable e) {
+ } catch (final Throwable e) {
+ // Detect problems caused by removed region
+ if (Objects.isNull(regionManager.getRegionLock(groupId))) {
+ final String errorMsg =
+ "Exception "
+ + e.getClass().getSimpleName()
+ + " encountered during region removal, will retry. Message: "
+ + e.getMessage();
+ LOGGER.info(errorMsg);
+ return RegionExecutionResult.create(
+ false, errorMsg,
RpcUtils.getStatus(TSStatusCode.NO_AVAILABLE_REGION_GROUP));
+ }
LOGGER.warn(e.getMessage(), e);
return RegionExecutionResult.create(
false,