JackieTien97 commented on code in PR #18939:
URL: https://github.com/apache/iotdb/pull/18939#discussion_r4324752196


##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/execution/QueryExecution.java:
##########
@@ -644,12 +644,17 @@ public ExecutionResult getStatus() {
     } catch (InterruptedException e) {
       // TODO: (xingtanzjr) use more accurate error handling
       Thread.currentThread().interrupt();
+      // An interrupted waiter can still observe a failure recorded before the 
interruption.
+      // Preserve its identity so callers do not mistake that failure for 
shutdown cancellation.
+      TSStatus failureStatus = stateMachine.getFailureStatus();
+      if (failureStatus != null) {
+        return new ExecutionResult(context.getQueryId(), failureStatus);

Review Comment:
   [P2] Preserve interruption provenance from remote write dispatch
   
   A non-null failure status is not necessarily an unrelated failure. If the 
internal reporter is stopped or reloaded while a remote write is waiting in 
`AsyncPlanNodeSender.waitUntilCompleted()`, `shutdownNow()` interrupts that 
wait. `FragmentInstanceDispatcherImpl.dispatchWrite()` catches the interruption 
and converts it to `INTERNAL_SERVER_ERROR` with `Interrupted errors: ...`; 
`ClusterScheduler.start()` then records that status as the query failure. The 
interrupt flag is still set when `getStatus()` runs, so this branch returns the 
interruption-generated status with `failureCausedByInterruption` defaulting to 
`false`. The reporter consequently logs a WARN for normal shutdown again.
   
   This is reproducible with the real scheduling/dispatch/status-handling path 
and a real executor, mocking only the RPC transport to delay its response. On 
c937b807 the result is `TSStatus(code:305, message:Interrupted errors: null)`, 
the marker is `false`, and the reporter logs WARN. Running the same probe with 
the corresponding b352989 classes logs DEBUG and passes. The dispatcher's 
existing ERROR log is separate; the regression here is the reintroduced 
reporter WARN.
   
   Please propagate explicit interruption provenance from the dispatch failure 
through to `ExecutionResult`, while retaining WARN for genuinely pre-existing 
failures. Add a regression test that stops the reporter during the remote 
dispatch wait, rather than only interrupting `QueryExecution.getStatus()` 
directly.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to