abhishekrb19 commented on code in PR #16362:
URL: https://github.com/apache/druid/pull/16362#discussion_r1588597505


##########
indexing-service/src/main/java/org/apache/druid/indexing/common/task/KillUnusedSegmentsTask.java:
##########
@@ -346,4 +347,24 @@ public LookupLoadingSpec getLookupLoadingSpec()
   {
     return LookupLoadingSpec.NONE;
   }
+
+  @Override
+  public boolean isReady(TaskActionClient taskActionClient) throws Exception
+  {
+    final boolean isUsingConcurrentLocks = Boolean.TRUE.equals(
+        getContextValue(
+            Tasks.USE_CONCURRENT_LOCKS,
+            Tasks.DEFAULT_USE_CONCURRENT_LOCKS
+        )
+    );
+
+    TaskLockType defaultLockType = !markAsUnused && isUsingConcurrentLocks ? 
TaskLockType.REPLACE : TaskLockType.EXCLUSIVE;
+
+    TaskLockType actualLockType = getContextValue(Tasks.TASK_LOCK_TYPE, 
defaultLockType);
+
+    if (markAsUnused && actualLockType != TaskLockType.EXCLUSIVE) {

Review Comment:
   Yeah, we can remove the deprecated `markAsUnused` parameter from the kill 
task. IMO, it'd be best if we handle that separately first since this feature 
expands on the deprecated parameter when it shouldn't be used and needed. 
   
   Alternatively, as part of this patch, we can add a validation check in the 
kill task constructor, similar to 
[this](https://github.com/apache/druid/blob/master/indexing-service/src/main/java/org/apache/druid/indexing/common/task/KillUnusedSegmentsTask.java#L144).
 The `isReady()` method here can then assume that `markAsUnused` is unset or 
false, so we'd have fewer branches.
   
   The branch for Druid 30 is already cut here: 
https://github.com/apache/druid/tree/30.0.0. So any changes merged to master 
from now on will automatically be targeted for Druid 31. Let us know what 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: [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