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


##########
indexing-service/src/main/java/org/apache/druid/indexing/common/actions/SegmentTransactionalReplaceAction.java:
##########
@@ -169,14 +171,33 @@ private void registerUpgradedPendingSegmentsOnSupervisor(
       List<PendingSegmentRecord> upgradedPendingSegments
   )
   {
+    // Emit the count of upgrades this commit produced regardless of whether a 
supervisor exists to
+    // receive them, so it can be compared against the count actually 
announced by tasks.
+    if (!upgradedPendingSegments.isEmpty()) {
+      final ServiceMetricEvent.Builder metricBuilder = new 
ServiceMetricEvent.Builder();
+      IndexTaskUtils.setTaskDimensions(metricBuilder, task);
+      
toolbox.getEmitter().emit(metricBuilder.setMetric(SegmentUpgradeMetrics.COUNT, 
upgradedPendingSegments.size()));
+    }
+
     final SupervisorManager supervisorManager = toolbox.getSupervisorManager();
     final Optional<String> activeSupervisorIdWithAppendLock =
         
supervisorManager.getActiveSupervisorIdForDatasourceWithAppendLock(task.getDataSource());
 
     if (!activeSupervisorIdWithAppendLock.isPresent()) {
+      log.info("No active streaming supervisor for datasource[%s]; the [%d] 
upgraded pending segment(s) from task[%s]"
+               + " will become queryable when their tasks hand off.",
+                task.getDataSource(),
+                upgradedPendingSegments.size(),
+                task.getId()
+      );
       return;
     }
 
+    log.info("Registering [%d] upgraded pending segments created by task[%s] 
on supervisor[%s]",
+             upgradedPendingSegments.size(),
+             task.getId(),
+             activeSupervisorIdWithAppendLock.get()
+    );
     upgradedPendingSegments.forEach(
         upgradedPendingSegment -> 
supervisorManager.registerUpgradedPendingSegmentOnSupervisor(

Review Comment:
   Maybe the `registerUpgradedPendingSegment` method should return the number 
of tasks that were notified for this pending segment. We could log a summary 
map of pending segment ID to number of tasks notified.



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