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


##########
indexing-service/src/main/java/org/apache/druid/indexing/common/actions/TaskActionToolbox.java:
##########
@@ -140,25 +154,46 @@ public boolean canBatchSegmentAllocation()
   }
 
   /**
-   * Checks if the given publish action should be failed without allowing any
-   * more retries. A failed publish action should be retried only if there is
-   * another task waiting to publish offsets for an overlapping set of 
partitions.
+   * Performs the segment publish action when the given task is unblocked for 
publish.
+   * A streaming task must wait for previously created tasks that are
+   * yet to publish offsets for an overlapping set of partitions.
    */
-  public boolean shouldFailSegmentPublishImmediately(
-      SegmentPublishResult result,
+  public ListenableFuture<SegmentPublishResult> publishSegmentsWhenReady(
       Task task,
       String supervisorId,
-      DataSourceMetadata startMetadata
+      DataSourceMetadata startMetadata,
+      BiFunction<Task, TaskActionToolbox, SegmentPublishResult> publishAction
   )
   {
-    if (result.isSuccess() || !result.isRetryable() || startMetadata == null) {
-      return false;
+    // Try publishing later if the failure was due to offset mismatch
+    final ListenableFuture<Boolean> taskReadyToPublishFuture;
+    if (startMetadata == null || supervisorId == null) {
+      taskReadyToPublishFuture = Futures.immediateFuture(true);
+    } else {
+      taskReadyToPublishFuture = 
supervisorManager.isTaskReadyToPublishSegments(
+          supervisorId,
+          task.getId(),
+          startMetadata
+      );
     }
 
-    return !getSupervisorManager().isAnotherTaskGroupPublishingToPartitions(
-        supervisorId,
-        task.getId(),
-        startMetadata
+    return Futures.transform(

Review Comment:
   The default timeout has no been increased to 15 minutes.
   Moreover, on timeout, the task will retry. So this failure is okay.
   A future patch may tie this up to the completion timeout.



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