Skip to content

Commit b8265e3

Browse files
modify the deal strategy for metadata lease exception in DataDriver and ErrorHandlingUtils (#18438)
1 parent 72798c5 commit b8265e3

2 files changed

Lines changed: 19 additions & 6 deletions

File tree

‎iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/driver/DataDriver.java‎

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@
2121

2222
import org.apache.iotdb.calc.exception.QueryProcessException;
2323
import org.apache.iotdb.calc.execution.operator.Operator;
24+
import org.apache.iotdb.commons.exception.MetadataLeaseFencedException;
2425
import org.apache.iotdb.db.i18n.DataNodeQueryMessages;
26+
import org.apache.iotdb.db.i18n.DataNodeSchemaMessages;
2527
import org.apache.iotdb.db.queryengine.execution.operator.source.DataSourceOperator;
2628
import org.apache.iotdb.db.queryengine.plan.planner.plan.FragmentInstance;
2729
import org.apache.iotdb.db.storageengine.dataregion.read.IQueryDataSource;
@@ -65,21 +67,29 @@ protected boolean init(SettableFuture<?> blockedFuture) {
6567
} else {
6668
return true;
6769
}
70+
} catch (MetadataLeaseFencedException e) {
71+
LOGGER.info(
72+
DataNodeSchemaMessages.METADATA_LEASE_IS_FENCED, driverContext.getDriverTaskID(), e);
73+
handleInitFailure(e, blockedFuture);
6874
} catch (Throwable t) {
6975
LOGGER.error(
7076
DataNodeQueryMessages.FAILED_TO_DO_THE_INITIALIZATION_FOR_DRIVER_ARG,
7177
driverContext.getDriverTaskID(),
7278
t);
73-
driverContext.failed(t);
74-
blockedFuture.setException(t);
75-
throwIfUnchecked(t);
76-
// should never happen
77-
throw new AssertionError(t);
79+
handleInitFailure(t, blockedFuture);
7880
}
7981
}
8082
return true;
8183
}
8284

85+
private void handleInitFailure(Throwable t, SettableFuture<?> blockedFuture) {
86+
driverContext.failed(t);
87+
blockedFuture.setException(t);
88+
throwIfUnchecked(t);
89+
// should never happen
90+
throw new AssertionError(t);
91+
}
92+
8393
@Override
8494
public boolean isInit() {
8595
return init;

‎iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/ErrorHandlingUtils.java‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,10 @@ public static TSStatus onQueryException(Exception e, String operation, TSStatusC
135135
|| status.getCode() == TSStatusCode.PATH_ALREADY_EXIST.getStatusCode()
136136
|| status.getCode() == TSStatusCode.PIPE_NOT_EXIST_ERROR.getStatusCode()
137137
|| status.getCode() == TSStatusCode.QUERY_TIMEOUT.getStatusCode()
138-
|| status.getCode() == TSStatusCode.CANNOT_READ_TSFILE.getStatusCode()) {
138+
|| status.getCode() == TSStatusCode.CANNOT_READ_TSFILE.getStatusCode()
139+
|| status.getCode() == TSStatusCode.METADATA_LEASE_FENCED.getStatusCode()
140+
|| status.getCode()
141+
== TSStatusCode.METADATA_LEASE_FENCED_RETRY_REQUIRED.getStatusCode()) {
139142
LOGGER.info(message);
140143
} else {
141144
LOGGER.warn(message, e);

0 commit comments

Comments
 (0)