This is an automated email from the ASF dual-hosted git repository.
tanxinyu pushed a commit to branch dev/1.3
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/dev/1.3 by this push:
new d60844b5aa3 [To dev/1.3] Optimized the error log & enable retry for
exceptions caused by concurrent removal of regions (#15076) #15078
d60844b5aa3 is described below
commit d60844b5aa32c850245e41f6c9391ba44ec179bf
Author: Caideyipi <[email protected]>
AuthorDate: Thu Mar 13 19:56:00 2025 +0800
[To dev/1.3] Optimized the error log & enable retry for exceptions caused
by concurrent removal of regions (#15076) #15078
---
.../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 46b56804b36..1f11c86ad99 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
@@ -83,6 +83,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 {
@@ -142,9 +143,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,
@@ -152,7 +153,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,