You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by GitBox <gi...@apache.org> on 2022/10/05 20:03:27 UTC

[GitHub] [druid] abhishekagarwal87 commented on a diff in pull request #13172: Fix Overlord leader election when task lock re-acquisition fails

abhishekagarwal87 commented on code in PR #13172:
URL: https://github.com/apache/druid/pull/13172#discussion_r985719442


##########
indexing-service/src/main/java/org/apache/druid/indexing/overlord/TaskLockbox.java:
##########
@@ -197,17 +205,26 @@ public int compare(Pair<Task, TaskLock> left, Pair<Task, TaskLock> right)
           activeTasks.size(),
           storedLocks.size() - taskLockCount
       );
+
+      for (Task task : failedToReacquireLockTasks) {
+        for (TaskLock lock : taskStorage.getLocks(task.getId())) {
+          taskStorage.removeLock(task.getId(), lock);
+        }
+        taskStorage.setStatus(TaskStatus.failure(task.getId(), "Failed to reacquire lock"));

Review Comment:
   This doesn't seem the right thing to do in `TaskLockbox`. If you notice, the `taskMaster` is used in this class to manipulate the locks and that's it. Lockbox doesn't modify any state other than the locks. We could maybe return the list of tasks for which we could not acquire locks to the caller. As you do this, it will be better to return a `Result` object where we can add more info later if needed. what do you think? 



-- 
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: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org