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


##########
indexing-service/src/main/java/org/apache/druid/indexing/overlord/TaskLockbox.java:
##########
@@ -197,7 +206,19 @@ public int compare(Pair<Task, TaskLock> left, Pair<Task, 
TaskLock> right)
           activeTasks.size(),
           storedLocks.size() - taskLockCount
       );
+
+      // unlock all TaskLockPosse created, and also remove lock entries from 
storage
+      for (Task task : failedToReacquireLockTasks) {
+        unlockAll(task);
+        for (TaskLock lock : taskStorage.getLocks(task.getId())) {
+          taskStorage.removeLock(task.getId(), lock);
+        }
+      }
+      return new SyncResult(
+          ImmutableList.copyOf(failedToReacquireLockTasks)

Review Comment:
   I think wrapping inside ImmutableList is unnecessary. 



##########
indexing-service/src/main/java/org/apache/druid/indexing/overlord/TaskLockbox.java:
##########
@@ -197,7 +206,19 @@ public int compare(Pair<Task, TaskLock> left, Pair<Task, 
TaskLock> right)
           activeTasks.size(),
           storedLocks.size() - taskLockCount
       );
+
+      // unlock all TaskLockPosse created, and also remove lock entries from 
storage
+      for (Task task : failedToReacquireLockTasks) {
+        unlockAll(task);
+        for (TaskLock lock : taskStorage.getLocks(task.getId())) {
+          taskStorage.removeLock(task.getId(), lock);
+        }

Review Comment:
   should this all be in a block where the exceptions can be ignored? 



##########
indexing-service/src/main/java/org/apache/druid/indexing/overlord/SyncResult.java:
##########
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.druid.indexing.overlord;
+
+import org.apache.druid.indexing.common.task.Task;
+
+import java.util.List;
+
+/**
+ * Result of TaskLockbox#syncFromStorage()

Review Comment:
   nit-pick - This description could be improved. 



##########
indexing-service/src/main/java/org/apache/druid/indexing/overlord/TaskMaster.java:
##########
@@ -416,4 +418,22 @@ public Map<String, Long> getBlacklistedTaskSlotCount()
       return null;
     }
   }
+
+  /**
+   * Process the results of synchronization from storage
+   *
+   * @param syncResult to be processed
+   * @param taskStorage stores tasks
+   * @param taskRunner runs tasks and holds state
+   */
+  private void processSyncResult(SyncResult syncResult, TaskStorage 
taskStorage, TaskRunner taskRunner)
+  {
+    String taskReacquisitionFailure = "Failed to reacquire lock";
+    for (Task task : syncResult.getTasksToFail()) {
+      // Shutdown task if it is running
+      taskRunner.shutdown(task.getId(), taskReacquisitionFailure);
+      // Mark as failed
+      taskStorage.setStatus(TaskStatus.failure(task.getId(), 
taskReacquisitionFailure));

Review Comment:
   should we ignore any exception in this block? 



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