Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Try to fix error code different in each data node problem #14808

Merged
merged 1 commit into from
Feb 10, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
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;
Expand Down Expand Up @@ -375,19 +376,32 @@ public void setDataNodeQueryContext(DataNodeQueryContext dataNodeQueryContext) {
}

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() {
Expand Down
Loading