kfaraz commented on code in PR #18448:
URL: https://github.com/apache/druid/pull/18448#discussion_r2309387181


##########
indexing-service/src/main/java/org/apache/druid/indexing/overlord/TaskQueue.java:
##########
@@ -250,6 +251,7 @@ public void start()
                 }
               }
             }
+

Review Comment:
   Nit: extra newline.



##########
indexing-service/src/main/java/org/apache/druid/indexing/overlord/TaskQueue.java:
##########
@@ -548,27 +550,32 @@ public boolean add(final Task task)
   }
 
   @GuardedBy("startStopLock")
-  private void addTaskInternal(final Task task, final DateTime updateTime)
+  private void addTaskInternal(final TaskInfo<Task, TaskStatus> taskInfo, 
final DateTime updateTime)
   {
     final AtomicBoolean added = new AtomicBoolean(false);
     final TaskEntry entry = addOrUpdateTaskEntry(
-        task.getId(),
+        taskInfo.getId(),
         prevEntry -> {
           if (prevEntry == null) {
             added.set(true);
-            return new TaskEntry(task);
+            return new TaskEntry(taskInfo);
           } else if (prevEntry.lastUpdatedTime.isBefore(updateTime)) {
             prevEntry.lastUpdatedTime = updateTime;
           }
 
+          // Ensure we keep the current status up-to-date
+          if (!prevEntry.taskInfo.getStatus().equals(taskInfo.getStatus())) {
+            prevEntry.taskInfo = taskInfo;

Review Comment:
   This update should happen inside the `if` clause before this, so that we 
have a consistent view.
   In fact, we should add a method to `TaskEntry.update(TaskInfo info)` which 
updates both the task info and the last updated time.



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