loquisgon commented on code in PR #12006:
URL: https://github.com/apache/druid/pull/12006#discussion_r877348465
##########
indexing-service/src/main/java/org/apache/druid/indexing/overlord/RemoteTaskRunner.java:
##########
@@ -652,37 +652,50 @@ public Optional<ByteSource> streamTaskReports(final
String taskId)
if (zkWorker == null) {
// Worker is not running this task, it might be available in deep storage
return Optional.absent();
- } else {
- TaskLocation taskLocation = runningTasks.get(taskId).getLocation();
- final URL url = TaskRunnerUtils.makeTaskLocationURL(
- taskLocation,
- "/druid/worker/v1/chat/%s/liveReports",
- taskId
- );
- return Optional.of(
- new ByteSource()
+ }
+
+ final RemoteTaskRunnerWorkItem runningWorkItem = runningTasks.get(taskId);
+
+ if (runningWorkItem == null) {
+ // Worker very recently exited.
+ return Optional.absent();
+ }
+
+ final TaskLocation taskLocation = runningWorkItem.getLocation();
+
+ if (TaskLocation.unknown().equals(taskLocation)) {
+ // No location known for this task. It may have not been assigned one
yet.
Review Comment:
If this check was added then it must be necessary but without reading the
rest of the code it feel s weird to see a running task with no location. It
seems like a task should not be in the running state if it does not have a
location but life's strange. Is this defensive programming or has this been
observed?
--
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]