cryptoe commented on code in PR #14322:
URL: https://github.com/apache/druid/pull/14322#discussion_r1299351989


##########
extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/exec/ControllerImpl.java:
##########
@@ -1299,17 +1310,36 @@ private void publishAllSegments(final Set<DataSegment> 
segments) throws IOExcept
       if (segmentsWithTombstones.isEmpty()) {
         // Nothing to publish, only drop. We already validated that the 
intervalsToDrop do not have any
         // partially-overlapping segments, so it's safe to drop them as 
intervals instead of as specific segments.
+        // This should not need a segment load wait as segments are marked as 
unused immediately.
         for (final Interval interval : intervalsToDrop) {
           context.taskActionClient()
                  .submit(new MarkSegmentsAsUnusedAction(task.getDataSource(), 
interval));
         }
       } else {
+        Set<String> versionsToAwait = 
segmentsWithTombstones.stream().map(DataSegment::getVersion).collect(Collectors.toSet());
+        segmentLoadWaiter = new SegmentLoadWaiter(
+            context.injector().getInstance(BrokerClient.class),
+            context.jsonMapper(),
+            task.getDataSource(),
+            versionsToAwait,
+            segmentsWithTombstones.size(),
+            true
+        );
         performSegmentPublish(
             context.taskActionClient(),
             SegmentTransactionalInsertAction.overwriteAction(null, null, 
segmentsWithTombstones)
         );
       }
     } else if (!segments.isEmpty()) {
+      Set<String> versionsToAwait = 
segments.stream().map(DataSegment::getVersion).collect(Collectors.toSet());

Review Comment:
   Oh i did not know that. Thanks for explaining the rational. We could also 
document this as well :)



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