FrankChen021 commented on code in PR #20740:
URL: https://github.com/apache/druid/pull/20740#discussion_r4400489381


##########
indexing-service/src/main/java/org/apache/druid/indexing/overlord/hrtr/HttpRemoteTaskRunner.java:
##########
@@ -1255,6 +1256,14 @@ public void shutdown(String taskId, String reason)
           if (workerHolderRunningTask == null) {
             log.info("Can't shutdown! No worker running task[%s]", taskId);
           }
+        } else if (taskRunnerWorkItem.getState() == 
HttpRemoteTaskRunnerWorkItem.State.PENDING) {
+          // Removing it here stops the pending task executor from picking it 
up before it is completed below.
+          pendingTaskIds.remove(taskId);
+          pendingWorkItem = taskRunnerWorkItem;
+        } else if (taskRunnerWorkItem.getState() == 
HttpRemoteTaskRunnerWorkItem.State.PENDING_WORKER_ASSIGN) {
+          // The thread assigning this task owns the work item. Once the 
worker runs the task, or the item goes back
+          // to PENDING, a later shutdown request handles it.
+          pendingTaskIds.remove(taskId);

Review Comment:
   ## Follow-up assessment
   
   Thanks for the clarification. I rechecked the current head and agree this is 
a narrow worker-dropout race, but the state handoff is still real: if 
shutdown() removes the ID at line 1266 before runTaskOnWorker() returns false, 
the existing revert to PENDING does not restore the ID or complete the runner 
future. The task will not launch, and TaskQueue normally retries cleanup on the 
next storage-sync cycle, so I’m treating this as a non-blocking P2 follow-up 
rather than requiring a change in this PR. Please track the cancellation-marker 
and failed-assignment path separately.
   
   Reviewed 2 of 2 changed files for this follow-up.
   
   <!-- mergelens:review -->



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to