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_r263404675
 
 

 ##########
 File path: 
server/src/main/java/org/apache/druid/server/coordinator/helper/DruidCoordinatorBalancer.java
 ##########
 @@ -180,7 +180,18 @@ private void balanceTier(
     //noinspection ForLoopThatDoesntUseLoopVariable
     for (int iter = 0; (moved + unmoved) < maxSegmentsToMove; ++iter) {
       final BalancerSegmentHolder segmentToMoveHolder = 
strategy.pickSegmentToMove(toMoveFrom);
-      if (segmentToMoveHolder != null && 
params.getAvailableSegments().contains(segmentToMoveHolder.getSegment())) {
+      if (segmentToMoveHolder == null) {
+        log.info("All servers to move segments from are empty, ending run.");
+        break;
+      }
+      // DruidCoordinatorRuntimeParams.getAvailableSegments originate from 
MetadataSegmentManager, i. e. that's a
+      // "desired" or "theoretical" set of segments. 
segmentToMoveHolder.getSegment originates from ServerInventoryView,
+      // i. e. that may be any segment that happens to be loaded of some 
server, even if it "shouldn't" from the
+      // "theoretical" point of view (Coordinator closes such discrepancies 
eventually via
+      // DruidCoordinatorCleanupUnneeded). Therefore the picked 
segmentToMoveHolder's segment may not need to be
+      // balanced.
+      boolean needToBalacePickedSegment = 
params.getAvailableSegments().contains(segmentToMoveHolder.getSegment());
 
 Review comment:
   Thanks, fixed the typo.
   
   I like to keep it a little on the verbose side.

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

Reply via email to