jtuglu1 commented on code in PR #18851: URL: https://github.com/apache/druid/pull/18851#discussion_r2647257312
########## indexing-service/src/main/java/org/apache/druid/indexing/overlord/hrtr/HttpRemoteTaskRunner.java: ########## @@ -466,60 +377,82 @@ private boolean runTaskOnWorker( // because that is attached by TaskQueue to task result future. So, this method must not be called with "statusLock" // held. See https://github.com/apache/druid/issues/6201 private void taskComplete( - HttpRemoteTaskRunnerWorkItem taskRunnerWorkItem, - WorkerHolder workerHolder, + String taskId, + String workerHost, TaskStatus taskStatus ) { - Preconditions.checkState(!Thread.holdsLock(statusLock), "Current thread must not hold statusLock."); - Preconditions.checkNotNull(taskRunnerWorkItem, "taskRunnerWorkItem"); - Preconditions.checkNotNull(taskStatus, "taskStatus"); - if (workerHolder != null) { - log.info( - "Worker[%s] completed task[%s] with status[%s]", - workerHolder.getWorker().getHost(), - taskStatus.getId(), - taskStatus.getStatusCode() - ); - // Worker is done with this task - workerHolder.setLastCompletedTaskTime(DateTimes.nowUtc()); - } + Preconditions.checkState(!Thread.holdsLock(workerStateLock), "Current thread must not hold workerStateLock."); + Preconditions.checkState(!Thread.holdsLock(taskStateLock), "Current thread must not hold taskStateLock."); - if (taskRunnerWorkItem.getResult().isDone()) { - // This is not the first complete event. - try { - TaskState lastKnownState = taskRunnerWorkItem.getResult().get().getStatusCode(); - if (taskStatus.getStatusCode() != lastKnownState) { - log.warn( - "The state of the new task complete event is different from its last known state. " - + "New state[%s], last known state[%s]", - taskStatus.getStatusCode(), - lastKnownState - ); + AtomicBoolean taskCompleted = new AtomicBoolean(false); + + tasks.compute( + taskId, + (key, taskEntry) -> { + Preconditions.checkState(taskEntry != null, "Expected task[%s] to exist", taskId); + if (taskEntry.getResult().isDone()) { Review Comment: Not object to changing, but any reason for changing this now? This is the current method used in the current runner. -- 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]
