This is an automated email from the ASF dual-hosted git repository.

JackieTien97 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 4b237744707 modify the deal strategy for metadata lease exception in 
DataDriver and ErrorHandlingUtils (#18438)
4b237744707 is described below

commit 4b2377447072b08ca48478ae2d4fe587fc10153c
Author: CYB <[email protected]>
AuthorDate: Tue Aug 11 14:06:44 2026 +0800

    modify the deal strategy for metadata lease exception in DataDriver and 
ErrorHandlingUtils (#18438)
---
 .../db/queryengine/execution/driver/DataDriver.java  | 20 +++++++++++++++-----
 .../apache/iotdb/db/utils/ErrorHandlingUtils.java    |  5 ++++-
 2 files changed, 19 insertions(+), 6 deletions(-)

diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/driver/DataDriver.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/driver/DataDriver.java
index 6b129549b09..c8612d9b563 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/driver/DataDriver.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/driver/DataDriver.java
@@ -21,7 +21,9 @@ package org.apache.iotdb.db.queryengine.execution.driver;
 
 import org.apache.iotdb.calc.exception.QueryProcessException;
 import org.apache.iotdb.calc.execution.operator.Operator;
+import org.apache.iotdb.commons.exception.MetadataLeaseFencedException;
 import org.apache.iotdb.db.i18n.DataNodeQueryMessages;
+import org.apache.iotdb.db.i18n.DataNodeSchemaMessages;
 import 
org.apache.iotdb.db.queryengine.execution.operator.source.DataSourceOperator;
 import org.apache.iotdb.db.queryengine.plan.planner.plan.FragmentInstance;
 import org.apache.iotdb.db.storageengine.dataregion.read.IQueryDataSource;
@@ -65,21 +67,29 @@ public class DataDriver extends Driver {
         } else {
           return true;
         }
+      } catch (MetadataLeaseFencedException e) {
+        LOGGER.info(
+            DataNodeSchemaMessages.METADATA_LEASE_IS_FENCED, 
driverContext.getDriverTaskID(), e);
+        handleInitFailure(e, blockedFuture);
       } catch (Throwable t) {
         LOGGER.error(
             
DataNodeQueryMessages.FAILED_TO_DO_THE_INITIALIZATION_FOR_DRIVER_ARG,
             driverContext.getDriverTaskID(),
             t);
-        driverContext.failed(t);
-        blockedFuture.setException(t);
-        throwIfUnchecked(t);
-        // should never happen
-        throw new AssertionError(t);
+        handleInitFailure(t, blockedFuture);
       }
     }
     return true;
   }
 
+  private void handleInitFailure(Throwable t, SettableFuture<?> blockedFuture) 
{
+    driverContext.failed(t);
+    blockedFuture.setException(t);
+    throwIfUnchecked(t);
+    // should never happen
+    throw new AssertionError(t);
+  }
+
   @Override
   public boolean isInit() {
     return init;
diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/ErrorHandlingUtils.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/ErrorHandlingUtils.java
index 5e9c1758664..b6154b059d5 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/ErrorHandlingUtils.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/ErrorHandlingUtils.java
@@ -136,7 +136,10 @@ public class ErrorHandlingUtils {
             || status.getCode() == 
TSStatusCode.PIPE_NOT_EXIST_ERROR.getStatusCode()
             || status.getCode() == TSStatusCode.QUERY_TIMEOUT.getStatusCode()
             || status.getCode() == 
TSStatusCode.CANNOT_READ_TSFILE.getStatusCode()
-            || status.getCode() == 
TSStatusCode.COPY_TO_WRITE_ERROR.getStatusCode()) {
+            || status.getCode() == 
TSStatusCode.COPY_TO_WRITE_ERROR.getStatusCode()
+            || status.getCode() == 
TSStatusCode.METADATA_LEASE_FENCED.getStatusCode()
+            || status.getCode()
+                == 
TSStatusCode.METADATA_LEASE_FENCED_RETRY_REQUIRED.getStatusCode()) {
           LOGGER.info(message);
         } else {
           LOGGER.warn(message, e);

Reply via email to