jiajunwang commented on a change in pull request #639: Refine the WAGED
rebalancer to minimize the partial rebalance workload.
URL: https://github.com/apache/helix/pull/639#discussion_r352875366
##########
File path:
helix-core/src/main/java/org/apache/helix/controller/rebalancer/waged/WagedRebalancer.java
##########
@@ -482,45 +507,23 @@ private void
refreshBaseline(ResourceControllerDataProvider clusterData,
}
/**
- * Generate the cluster model based on the input and calculate the optimal
assignment.
- * @param clusterData the cluster data cache.
- * @param clusterChanges the detected cluster changes.
- * @param resourceMap the rebalancing resources.
- * @param activeNodes the alive and enabled nodes.
- * @param baseline the baseline assignment for the algorithm as a reference.
- * @param prevBestPossibleAssignment the previous best possible assignment
for the algorithm as a
- * reference.
+ * @param clusterModel the cluster model that contains all the cluster
status for the purpose of
+ * rebalance calculating.
* @return the new optimal assignment for the resources.
*/
- private Map<String, ResourceAssignment> calculateAssignment(
- ResourceControllerDataProvider clusterData,
- Map<HelixConstants.ChangeType, Set<String>> clusterChanges, Map<String,
Resource> resourceMap,
- Set<String> activeNodes, Map<String, ResourceAssignment> baseline,
- Map<String, ResourceAssignment> prevBestPossibleAssignment) throws
HelixRebalanceException {
+ private Map<String, ResourceAssignment> calculateAssignment(ClusterModel
clusterModel,
+ RebalanceAlgorithm algorithm)
+ throws HelixRebalanceException {
long startTime = System.currentTimeMillis();
LOG.info("Start calculating for an assignment");
- ClusterModel clusterModel;
- try {
- clusterModel = ClusterModelProvider.generateClusterModel(clusterData,
resourceMap,
- activeNodes, clusterChanges, baseline, prevBestPossibleAssignment);
- } catch (Exception ex) {
- throw new HelixRebalanceException("Failed to generate cluster model.",
- HelixRebalanceException.Type.INVALID_CLUSTER_STATUS, ex);
- }
-
- OptimalAssignment optimalAssignment =
_rebalanceAlgorithm.calculate(clusterModel);
+ OptimalAssignment optimalAssignment = algorithm.calculate(clusterModel);
Map<String, ResourceAssignment> newAssignment =
optimalAssignment.getOptimalResourceAssignment();
-
- LOG.info("Finish calculating an assignment. Took: {} ms.",
System.currentTimeMillis() - startTime);
-
+ LOG.info("Finish calculating an assignment. Took: {} ms.",
Review comment:
Sounds good.
----------------------------------------------------------------
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]