abhishekrb19 commented on code in PR #15941:
URL: https://github.com/apache/druid/pull/15941#discussion_r1501755441


##########
server/src/test/java/org/apache/druid/server/coordinator/simulate/TestSegmentsMetadataManager.java:
##########
@@ -221,7 +242,29 @@ public List<Interval> getUnusedSegmentIntervals(
       final DateTime maxUsedStatusLastUpdatedTime
   )
   {
-    return null;
+    final List<DataSegmentPlus> sortedUnusedSegmentPluses = new 
ArrayList<>(unusedSegments.values());
+    sortedUnusedSegmentPluses.sort(
+        Comparator.comparingLong(
+            dataSegmentPlus -> 
dataSegmentPlus.getDataSegment().getInterval().getStartMillis()
+        )
+    );
+
+    final List<Interval> unusedSegmentIntervals = new ArrayList<>();
+
+    for (final DataSegmentPlus unusedSegmentPlus : sortedUnusedSegmentPluses) {
+      final DataSegment unusedSegment = unusedSegmentPlus.getDataSegment();
+      if (dataSource.equals(unusedSegment.getDataSource())) {
+        final Interval interval = unusedSegment.getInterval();
+
+        if ((minStartTime == null || 
interval.getStart().isAfter(minStartTime)) &&
+            interval.getEnd().isBefore(maxEndTime) &&
+            
unusedSegmentPlus.getUsedStatusLastUpdatedDate().isBefore(maxUsedStatusLastUpdatedTime))
 {
+          unusedSegmentIntervals.add(interval);
+        }
+      }
+    }
+    log.info("Found [%d] unused segment intervals: [%s]", 
unusedSegmentIntervals.size(), unusedSegmentIntervals);

Review Comment:
   Removed it as the new metric should suffice



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