FrankChen021 commented on code in PR #20291:
URL: https://github.com/apache/druid/pull/20291#discussion_r3958415518


##########
sql/src/main/java/org/apache/druid/sql/calcite/schema/BrokerSegmentMetadataCache.java:
##########
@@ -307,6 +307,17 @@ protected void removeSegmentAction(SegmentId segmentId)
     // noop, no additional action needed when segment is removed.
   }
 
+  @Override
+  protected void removeDataSourceAction(String dataSource)
+  {
+    // The last-segment callback can remove the table without another schema 
refresh.
+    emitMetric(

Review Comment:
   [P2] Avoid duplicate removal metrics during concurrent refresh
   
   This callback can race with BrokerSegmentMetadataCache.refresh(): refresh 
drains a datasource into its local dataSourcesToRebuild set and clears the 
guarded set before rebuilding outside the lock, then a concurrent last-segment 
callback emits DATASOURCE_REMOVED here. The in-flight refresh still processes 
that local datasource (and can emit DATASOURCE_REMOVED again when its row 
signature is null), so one removal can produce duplicate metrics. The 
synchronous regression test only verifies that a later refresh does not use 
stale state; please coordinate or re-check in-flight rebuilds before 
emitting/rebuilding.



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