kfaraz commented on code in PR #16393:
URL: https://github.com/apache/druid/pull/16393#discussion_r1592604369


##########
indexing-service/src/main/java/org/apache/druid/indexing/overlord/TaskLockbox.java:
##########
@@ -1271,6 +1277,134 @@ public void remove(final Task task)
     }
   }
 
+  /**
+   * Verifies that every lock held by the replacing task is a REPLACE lock
+   * @param task replacing task
+   */
+  public void verifyLocksForReplaceTask(Task task)
+  {
+    for (TaskLockPosse lockPosse : findLockPossesForTask(task)) {
+      if (lockPosse.taskLock.getType() != TaskLockType.REPLACE) {
+        throw DruidException.defensive(
+            "All the locks must be of type REPLACE for 
segmentTransactionalReplace. Found lock of type[%s] for task[%s].",

Review Comment:
   >  If not, why can't this method be a part of the validation to acquire the 
transactional lock as was being done previously?
   
   The validation really doesn't belong in `TaskLockbox` because `TaskLockbox` 
itself doesn't impose the restriction on any task holding a certain type of 
locks.



##########
indexing-service/src/main/java/org/apache/druid/indexing/overlord/TaskLockbox.java:
##########
@@ -1271,6 +1277,134 @@ public void remove(final Task task)
     }
   }
 
+  /**
+   * Verifies that every lock held by the replacing task is a REPLACE lock
+   * @param task replacing task
+   */
+  public void verifyLocksForReplaceTask(Task task)
+  {
+    for (TaskLockPosse lockPosse : findLockPossesForTask(task)) {
+      if (lockPosse.taskLock.getType() != TaskLockType.REPLACE) {
+        throw DruidException.defensive(
+            "All the locks must be of type REPLACE for 
segmentTransactionalReplace. Found lock of type[%s] for task[%s].",

Review Comment:
   >  If not, why can't this method be a part of the validation to acquire the 
transactional lock as was being done previously?
   
   The validation doesn't really belong in `TaskLockbox` because `TaskLockbox` 
itself doesn't impose the restriction on any task holding a certain type of 
locks.



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