suneet-s commented on a change in pull request #9441: Improve
OvershadowableManager performance
URL: https://github.com/apache/druid/pull/9441#discussion_r389947980
##########
File path:
server/src/main/java/org/apache/druid/server/coordinator/duty/NewestSegmentFirstIterator.java
##########
@@ -509,12 +509,13 @@ private SegmentsToCompact findSegmentsToCompact(
private QueueEntry(List<DataSegment> segments)
{
Preconditions.checkArgument(segments != null && !segments.isEmpty());
- Collections.sort(segments);
+ final List<DataSegment> segmentsToSort = new ArrayList<>(segments);
+ Collections.sort(segmentsToSort);
this.interval = new Interval(
- segments.get(0).getInterval().getStart(),
- segments.get(segments.size() - 1).getInterval().getEnd()
+ segmentsToSort.get(0).getInterval().getStart(),
+ segmentsToSort.get(segmentsToSort.size() - 1).getInterval().getEnd()
);
- this.segments = segments;
+ this.segments = segmentsToSort;
Review comment:
Does the order of the segments matter?
Why not just calculate the min start and max end with O(n) implementation by
looping over `segments`
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]