You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by GitBox <gi...@apache.org> on 2019/01/10 20:49:14 UTC

[GitHub] egor-ryashin commented on a change in pull request #6829: Don't force rebalance of the whole cluster all the time

egor-ryashin commented on a change in pull request #6829: Don't force rebalance of the whole cluster all the time
URL: https://github.com/apache/incubator-druid/pull/6829#discussion_r246907556
 
 

 ##########
 File path: server/src/main/java/org/apache/druid/server/coordinator/helper/DruidCoordinatorBalancer.java
 ##########
 @@ -106,8 +108,18 @@ private void balanceTier(
       return;
     }
 
-    final List<ServerHolder> toMoveFrom = Lists.newArrayList(servers);
-    final List<ServerHolder> toMoveTo = Lists.newArrayList(servers);
+    // Sort order is ascending based on available size. We reverse the "from" to shed the largest nodes first
+    final List<ServerHolder> toMoveFrom;
+    final List<ServerHolder> toMoveTo;
+
+    final int nodeLimit = params.getCoordinatorDynamicConfig().getBalancerNodeLimit();
+    if (nodeLimit > 0) {
+      toMoveFrom = Lists.reverse(randomSortedSubList(servers, nodeLimit));
+      toMoveTo = randomSortedSubList(servers, nodeLimit);
 
 Review comment:
   I think it doesn't matter if `toMoveTo` is in the sorted order or not, it seems to me the balancing strategy checks all servers (in the collection) anyway.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org