i3wangyi commented on a change in pull request #456: Add delayed rebalance and user-defined preference list features to the WAGED rebalancer. URL: https://github.com/apache/helix/pull/456#discussion_r328815788
########## File path: helix-core/src/main/java/org/apache/helix/controller/rebalancer/waged/WagedRebalancer.java ########## @@ -196,17 +193,35 @@ public void close() { clusterChanges.putIfAbsent(HelixConstants.ChangeType.CLUSTER_CONFIG, Collections.emptySet()); } + Set<String> activeNodes = new HashSet<>(clusterData.getEnabledLiveInstances()); + ClusterConfig clusterConfig = clusterData.getClusterConfig(); + if (DelayedRebalanceUtil.isDelayRebalanceEnabled(clusterConfig)) { + // If delayed rebalance is enabled, rebalance with the delayed active instance list. + Set<String> delayedActiveNodes = DelayedRebalanceUtil + .getActiveInstances(clusterData.getAllInstances(), activeNodes, + clusterData.getInstanceOfflineTimeMap(), clusterData.getLiveInstances().keySet(), + clusterData.getInstanceConfigMap(), clusterConfig); + // Schedule delayed rebalance in case no later cluster event happens when the delay time + // window passes. + delayedRebalanceSchedule(clusterData, delayedActiveNodes); + activeNodes = delayedActiveNodes; Review comment: Can you make the line 196 - 207 into a private method that returns `Set<String>` where you can check the delayed logics inside, it'll increase the readbility ---------------------------------------------------------------- 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: reviews-unsubscr...@helix.apache.org For additional commands, e-mail: reviews-h...@helix.apache.org