jtuglu1 commented on code in PR #18448:
URL: https://github.com/apache/druid/pull/18448#discussion_r2311814616
##########
indexing-service/src/main/java/org/apache/druid/indexing/overlord/TaskQueue.java:
##########
@@ -548,27 +549,28 @@ 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
+ prevEntry.updateStatus(taskInfo.getStatus(), updateTime);
}
return prevEntry;
}
);
if (added.get()) {
- taskLockbox.add(task);
- } else if (!entry.task.equals(task)) {
- throw new ISE("Cannot add task[%s] as a different task for the same ID
has already been added.", task.getId());
+ taskLockbox.add(taskInfo.getTask());
+ } else if (!entry.getTask().equals(taskInfo.getTask())) {
+ throw new ISE("Cannot add task[%s] as a different task for the same ID
has already been added.", taskInfo.getTask().getId());
Review Comment:
Yeah – in this case `taskInfo.getId()` will always be the task ID, I
originally left it as accessing the task directly for safety.
--
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]