AmatyaAvadhanula commented on code in PR #14246:
URL: https://github.com/apache/druid/pull/14246#discussion_r1190581388


##########
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:
   1. An appending task requests for a SHARED lock over May, 2023 (The interval 
is explicitly specified)
   2. An appending task asks for DAY granularity SHARED locks for a few dates 
for the same month, the latest of which is from 26th to 27th. (The interval is 
not explicitly specified, and the task allocates locks with day-granular 
intervals)
   3. A new replacing task with DAY segment granularity requests a lock from 
28th, May to 3rd June in 2023. This lock should not be granted, but it is in 
the current code. (The interval is explicitly specified to be the above week)
   
   I agree that this is very unlikely, but it is possible when one tries to 
specify the ingestion interval instead of letting the task determine it. It's 
also possible when WEEK granular segments are being ingested



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