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

 ##########
 File path: 
helix-core/src/main/java/org/apache/helix/controller/rebalancer/waged/model/ClusterModelProvider.java
 ##########
 @@ -75,9 +150,25 @@ public static ClusterModel 
generateClusterModel(ResourceControllerDataProvider d
     // Check if the replicas need to be reassigned.
     Map<String, Set<AssignableReplica>> allocatedReplicas =
         new HashMap<>(); // <instanceName, replica set>
-    Set<AssignableReplica> toBeAssignedReplicas =
-        findToBeAssignedReplicas(replicaMap, clusterChanges, activeInstances,
-            dataProvider.getLiveInstances().keySet(), bestPossibleAssignment, 
allocatedReplicas);
+    Set<AssignableReplica> toBeAssignedReplicas;
+    switch (scopeType) {
+      case GLOBAL_BASELINE:
+        toBeAssignedReplicas = 
findToBeAssignedReplicasByClusterChanges(replicaMap, activeInstances,
+            dataProvider.getLiveInstances().keySet(), clusterChanges, 
bestPossibleAssignment,
+            allocatedReplicas);
+        break;
+      case PARTIAL:
+        // Filter to remove the replicas that do not exist in the baseline 
given but exist in
+        // replicaMap. This is because such replicas are new additions that do 
not need to be
+        // rebalanced right away.
+        retainExistingReplicas(replicaMap, baselineAssignment);
+        toBeAssignedReplicas =
+            findToBeAssignedReplicasByComparingBaseline(replicaMap, 
activeInstances,
+                baselineAssignment, bestPossibleAssignment, allocatedReplicas);
+        break;
 
 Review comment:
   I don't think the switch is needed because 1. the enum is private 2. even 
the caller of the method is private, thus the default case will never be used.

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

Reply via email to