You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ja...@apache.org on 2025/02/10 01:04:06 UTC
(iotdb) branch master updated: Try fix error code different in each data node problem
This is an automated email from the ASF dual-hosted git repository.
jackietien 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 c2625d07ec0 Try fix error code different in each data node problem
c2625d07ec0 is described below
commit c2625d07ec0f78b94234bde749122c255cd1c8c1
Author: Jackie Tien <ja...@gmail.com>
AuthorDate: Mon Feb 10 09:04:01 2025 +0800
Try fix error code different in each data node problem
---
.../fragment/FragmentInstanceContext.java | 40 +++++++++++++++-------
1 file changed, 27 insertions(+), 13 deletions(-)
diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/fragment/FragmentInstanceContext.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/fragment/FragmentInstanceContext.java
index b72e27fa342..14629fa37fa 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/fragment/FragmentInstanceContext.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/fragment/FragmentInstanceContext.java
@@ -58,6 +58,7 @@ import java.util.Map;
import java.util.Optional;
import java.util.Set;
import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.atomic.AtomicLong;
import java.util.concurrent.atomic.AtomicReference;
import java.util.stream.Collectors;
@@ -375,19 +376,32 @@ public class FragmentInstanceContext extends QueryContext {
}
public FragmentInstanceInfo getInstanceInfo() {
- return getErrorCode()
- .map(
- s ->
- new FragmentInstanceInfo(
- stateMachine.getState(),
- getEndTime(),
- getFailedCause(),
- getFailureInfoList(),
- s))
- .orElseGet(
- () ->
- new FragmentInstanceInfo(
- stateMachine.getState(), getEndTime(), getFailedCause(), getFailureInfoList()));
+ FragmentInstanceState state = stateMachine.getState();
+ long endTime = getEndTime();
+ LinkedBlockingQueue<Throwable> failures = stateMachine.getFailureCauses();
+ String failureCause = "";
+ List<FragmentInstanceFailureInfo> failureInfoList = new ArrayList<>();
+ TSStatus status = null;
+
+ for (Throwable failure : failures) {
+ if (failureCause.isEmpty()) {
+ failureCause = failure.getMessage();
+ }
+ failureInfoList.add(FragmentInstanceFailureInfo.toFragmentInstanceFailureInfo(failure));
+ if (failure instanceof IoTDBException) {
+ status = new TSStatus(((IoTDBException) failure).getErrorCode());
+ status.setMessage(failure.getMessage());
+ } else if (failure instanceof IoTDBRuntimeException) {
+ status = new TSStatus(((IoTDBRuntimeException) failure).getErrorCode());
+ status.setMessage(failure.getMessage());
+ }
+ }
+
+ if (status == null) {
+ return new FragmentInstanceInfo(state, endTime, failureCause, failureInfoList);
+ } else {
+ return new FragmentInstanceInfo(state, endTime, failureCause, failureInfoList, status);
+ }
}
public FragmentInstanceStateMachine getStateMachine() {