leventov commented on a change in pull request #7185: Avoid many unnecessary materializations of collections of 'all segments in cluster' cardinality URL: https://github.com/apache/incubator-druid/pull/7185#discussion_r263403337
########## File path: server/src/main/java/org/apache/druid/server/coordinator/helper/DruidCoordinatorSegmentInfoLoader.java ########## @@ -42,8 +42,17 @@ public DruidCoordinatorRuntimeParams run(DruidCoordinatorRuntimeParams params) { log.info("Starting coordination. Getting available segments."); - // Display info about all available segments - final Set<DataSegment> availableSegments = coordinator.getOrderedAvailableDataSegments(); + final TreeSet<DataSegment> availableSegments = DruidCoordinatorRuntimeParams.createAvailableSegmentsSet(); + for (DataSegment segment : coordinator.iterateAvailableDataSegments()) { + if (segment.getSize() < 0) { + log.makeAlert("No size on a segment") Review comment: Good suggestion about making `Iterable<DataSegment>` a parameter of the method, applied. I've also retained the size checks. ---------------------------------------------------------------- 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: us...@infra.apache.org With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@druid.apache.org For additional commands, e-mail: commits-h...@druid.apache.org