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


##########
server/src/main/java/org/apache/druid/server/coordinator/duty/MarkEternityTombstonesAsUnused.java:
##########
@@ -132,43 +130,57 @@ public DruidCoordinatorRuntimeParams run(final 
DruidCoordinatorRuntimeParams par
   private Map<String, Set<SegmentId>> 
determineNonOvershadowedEternityTombstones(final DataSourcesSnapshot 
dataSourcesSnapshot)
   {
     final Map<String, Set<SegmentId>> 
datasourceToNonOvershadowedEternityTombstones = new HashMap<>();
+    final Map<String, Set<DataSegment>> overshadowedSegmentsByDatasource = new 
HashMap<>();
 
-    dataSourcesSnapshot.getDataSourcesMap().keySet().forEach((datasource) -> {
+    for (final DataSegment overshadowedSegment : 
dataSourcesSnapshot.getOvershadowedSegments()) {
+      overshadowedSegmentsByDatasource
+          .computeIfAbsent(overshadowedSegment.getDataSource(), ds -> new 
HashSet<>())
+          .add(overshadowedSegment);
+    }
+
+    for (final ImmutableDruidDataSource dataSource : 
dataSourcesSnapshot.getDataSourcesWithAllUsedSegments()) {
+      final String datasource = dataSource.getName();
       final SegmentTimeline usedSegmentsTimeline
           = 
dataSourcesSnapshot.getUsedSegmentsTimelinesPerDataSource().get(datasource);
+      if (usedSegmentsTimeline == null) {

Review Comment:
   Can this ever happen? We are already iterating over the datasources provided 
by the snapshot itself, so the timeline must be non null.



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