imply-cheddar commented on code in PR #14246:
URL: https://github.com/apache/druid/pull/14246#discussion_r1190505154


##########
indexing-service/src/test/java/org/apache/druid/indexing/overlord/TaskLockboxTest.java:
##########
@@ -1357,6 +1357,52 @@ public void testFailedToReacquireTaskLock() throws 
Exception
                         result.getTasksToFail());
   }
 
+  @Test
+  public void testConflictsWithOverlappingSharedLocks() throws Exception
+  {
+    final List<Task> tasks = new ArrayList<>();
+
+    final Task conflictingTask = NoopTask.create(10);
+    tasks.add(conflictingTask);
+    lockbox.add(conflictingTask);
+    taskStorage.insert(conflictingTask, 
TaskStatus.running(conflictingTask.getId()));
+    TaskLock conflictingLock = tryTimeChunkLock(
+        TaskLockType.SHARED,
+        conflictingTask,
+        Intervals.of("2023-05-01/2023-06-01")
+    ).getTaskLock();
+    Assert.assertNotNull(conflictingLock);
+    Assert.assertFalse(conflictingLock.isRevoked());
+
+    final Task floorTask = NoopTask.create(10);
+    tasks.add(floorTask);
+    lockbox.add(floorTask);
+    taskStorage.insert(floorTask, TaskStatus.running(floorTask.getId()));
+    TaskLock floorLock = tryTimeChunkLock(
+        TaskLockType.SHARED,
+        floorTask,
+        Intervals.of("2023-05-26/2023-05-27")
+    ).getTaskLock();
+    Assert.assertNotNull(floorLock);
+    Assert.assertFalse(floorLock.isRevoked());

Review Comment:
   Why should this return the lock?  I'm fairly certain that, while you *can* 
get tasks to request the locks that are being requested in this test, you have 
to actively do weird things to make that happen.  The normal way that tasks 
will ask for locks would align the intervals of the locks with things that 
already exist.  That is, I'm like 90% certain that this part of the test is 
exercising behavior that we don't expect nor want to happen in the wild.  
   
   I could be wrong though, so if you believe that this is a sequence of locks 
requests that can and should be able to happen, can you describe the set of 
tasks and data flow that are expected to be able to get these lock requests to 
occur? 



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