You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@helix.apache.org by GitBox <gi...@apache.org> on 2021/04/02 22:00:02 UTC

[GitHub] [helix] xyuanlu commented on a change in pull request #1691: Improve the WAGED.ConstraintBasedAlgorithm storing logic to prioritize replica with larger impact

xyuanlu commented on a change in pull request #1691:
URL: https://github.com/apache/helix/pull/1691#discussion_r606443029



##########
File path: helix-core/src/main/java/org/apache/helix/controller/rebalancer/waged/constraints/ConstraintBasedAlgorithm.java
##########
@@ -152,69 +179,147 @@ private double getAssignmentNormalizedScore(AssignableNode node, AssignableRepli
         .collect(Collectors.toList());
   }
 
-  private List<AssignableReplica> getOrderedAssignableReplica(ClusterModel clusterModel) {
-    Map<String, Set<AssignableReplica>> replicasByResource = clusterModel.getAssignableReplicaMap();
-    List<AssignableReplica> orderedAssignableReplicas =
-        replicasByResource.values().stream().flatMap(replicas -> replicas.stream())
-            .collect(Collectors.toList());
+  private Map<String, MutablePair<Integer, Integer>> computeOverallClusterUtil(
+      List<AssignableNode> nodes) {
+    Map<String, MutablePair<Integer, Integer>> utilizationMap = new HashMap<>();
+    for (AssignableNode node : nodes) {
+      for (String resourceKey : node.getMaxCapacity().keySet()) {
 
-    Map<String, ResourceAssignment> bestPossibleAssignment =
-        clusterModel.getContext().getBestPossibleAssignment();
-    Map<String, ResourceAssignment> baselineAssignment =
-        clusterModel.getContext().getBaselineAssignment();
+        if (utilizationMap.containsKey(resourceKey)) {
+          Integer newUtil = utilizationMap.get(resourceKey).getLeft() + node.getRemainingCapacity()

Review comment:
       Thanks for the review. I updated the PR based on our offline discussion. 




-- 
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@helix.apache.org
For additional commands, e-mail: reviews-help@helix.apache.org