AmatyaAvadhanula commented on code in PR #15724:
URL: https://github.com/apache/druid/pull/15724#discussion_r1496788584


##########
indexing-service/src/main/java/org/apache/druid/indexing/overlord/http/OverlordResource.java:
##########
@@ -469,9 +469,15 @@ public Response getMultipleTaskStatuses(Set<String> 
taskIds)
       return Response.status(Response.Status.BAD_REQUEST).entity("No TaskIds 
provided.").build();
     }
 
+    final Optional<TaskQueue> taskQueue = taskMaster.getTaskQueue();
     Map<String, TaskStatus> result = 
Maps.newHashMapWithExpectedSize(taskIds.size());
     for (String taskId : taskIds) {
-      Optional<TaskStatus> optional = 
taskStorageQueryAdapter.getStatus(taskId);
+      final Optional<TaskStatus> optional;
+      if (taskQueue.isPresent()) {

Review Comment:
   TaskQueue#getStatus looks at the metadata store if the task is not running
   
   ```
     public Optional<TaskStatus> getTaskStatus(final String taskId)
     {
       RunnerTaskState runnerTaskState = taskRunner.getRunnerTaskState(taskId);
       if (runnerTaskState != null && runnerTaskState != RunnerTaskState.NONE) {
         return 
Optional.of(TaskStatus.running(taskId).withLocation(taskRunner.getTaskLocation(taskId)));
       } else {
         return taskStorage.getStatus(taskId);
       }
     }
   ```
   
   Would it be better to move this fallback to db logic out of the TaskQueue in 
the calling method?



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