kfaraz commented on code in PR #18448:
URL: https://github.com/apache/druid/pull/18448#discussion_r2309403024
##########
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:
Alternatively, add a method `updateStatus(TaskStatus status)` which assigns
a new taskinfo object inside the `TaskEntry` like `this.taskInfo =
taskInfo.withStatus(status)`.
Having this method would clarify that only the status field is going to
change.
--
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]