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


##########
indexing-service/src/main/java/org/apache/druid/indexing/common/actions/SegmentTransactionalReplaceAction.java:
##########
@@ -116,50 +117,54 @@ public TypeReference<SegmentPublishResult> 
getReturnTypeReference()
   @Override
   public SegmentPublishResult perform(Task task, TaskActionToolbox toolbox)
   {
-    TaskLocks.checkLockCoversSegments(task, toolbox.getTaskLockbox(), 
segments);
-
-    // Find the active replace locks held only by this task
-    final Set<ReplaceTaskLock> replaceLocksForTask
-        = toolbox.getTaskLockbox().findReplaceLocksForTask(task);
-
-    final SegmentPublishResult publishResult;
+    final TaskLockbox taskLockbox = toolbox.getTaskLockbox();
+    TaskLocks.checkLockCoversSegments(task, taskLockbox, segments);
+    taskLockbox.acquireTransactionalReplaceLock(task, 
TaskLockbox.LOCK_ACQUIRE_TIMEOUT_MILLIS);
     try {
+      // Find the active replace locks held only by this task
+      final Set<ReplaceTaskLock> replaceLocksForTask
+          = toolbox.getTaskLockbox().findReplaceLocksForTask(task);
+
+      final SegmentPublishResult publishResult;
       publishResult = toolbox.getTaskLockbox().doInCriticalSection(
           task,
           
segments.stream().map(DataSegment::getInterval).collect(Collectors.toSet()),
           CriticalAction.<SegmentPublishResult>builder()
-              .onValidLocks(
-                  () -> toolbox.getIndexerMetadataStorageCoordinator()
-                               .commitReplaceSegments(segments, 
replaceLocksForTask, segmentSchemaMapping)
-              )
-              .onInvalidLocks(
-                  () -> SegmentPublishResult.fail(
-                      "Invalid task locks. Maybe they are revoked by a higher 
priority task."
-                      + " Please check the overlord log for details."
-                  )
-              )
-              .build()
+                        .onValidLocks(
+                            () -> 
toolbox.getIndexerMetadataStorageCoordinator()
+                                         .commitReplaceSegments(segments, 
replaceLocksForTask, segmentSchemaMapping)
+                        )
+                        .onInvalidLocks(
+                            () -> SegmentPublishResult.fail(
+                                "Invalid task locks. Maybe they are revoked by 
a higher priority task."
+                                + " Please check the overlord log for details."
+                            )
+                        )
+                        .build()

Review Comment:
   indentation need not be changed here.



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