YongGang commented on code in PR #16325:
URL: https://github.com/apache/druid/pull/16325#discussion_r1578339548


##########
indexing-service/src/main/java/org/apache/druid/indexing/common/TaskLock.java:
##########
@@ -62,4 +63,17 @@ public interface TaskLock
   boolean isRevoked();
 
   boolean conflict(LockRequest request);
+
+  /**
+   * Checks if the lock is revoked and throws a {@link 
LockAcquisitionFailedException} if so.
+   *
+   * @param interval The time interval for which the lock is acquired.
+   * @throws LockAcquisitionFailedException if the lock is revoked.
+   */
+  default void assertNotRevoked(Interval interval)
+  {
+    if (isRevoked()) {
+      throw new LockAcquisitionFailedException(interval);

Review Comment:
   One of the reason a new exception type was introduced is to distinguish 
terminal and intermittent task failures.
   In this case a lock acquisition failed exception is a intermittent failure 
means the operator not require to take action to fix this.
   If use the more general `DruidException`, though can look at the exception 
message to know the cause but that's easy to break as a minor _improvement_ on 
the message can break the checking logic external of Druid code.



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