jiajunwang commented on a change in pull request #514: The WAGED rebalancer 
returns the previously calculated assignment on calculation failure
URL: https://github.com/apache/helix/pull/514#discussion_r337327918
 
 

 ##########
 File path: 
helix-core/src/main/java/org/apache/helix/controller/rebalancer/waged/WagedRebalancer.java
 ##########
 @@ -593,37 +610,32 @@ private void 
delayedRebalanceSchedule(ResourceControllerDataProvider clusterData
    * @param clusterData the cluster data cache.
    * @param resourceMap the rebalanaced resource map.
    * @param clusterChanges the detected cluster changes that triggeres the 
rebalance.
-   * @param resourceStatePriorityMap the state priority map for each resource.
    * @param baseline the baseline assignment
    */
   private void applyRebalanceOverwrite(Map<String, IdealState> idealStateMap,
       ResourceControllerDataProvider clusterData, Map<String, Resource> 
resourceMap,
       Map<HelixConstants.ChangeType, Set<String>> clusterChanges,
-      Map<String, Map<String, Integer>> resourceStatePriorityMap,
       Map<String, ResourceAssignment> baseline) throws HelixRebalanceException 
{
     Set<String> enabledLiveInstances = clusterData.getEnabledLiveInstances();
     // Note that the calculation used the baseline as the input only. This is 
for minimizing
     // unnecessary partition movement.
-    Map<String, ResourceAssignment> activeAssignment = 
calculateAssignment(clusterData,
-        clusterChanges, resourceMap, enabledLiveInstances, 
Collections.emptyMap(), baseline);
+    Map<String, IdealState> activeIdealStates = 
convertResourceAssignment(clusterData,
+        calculateAssignment(clusterData, clusterChanges, resourceMap, 
enabledLiveInstances,
+            Collections.emptyMap(), baseline));
     for (String resourceName : idealStateMap.keySet()) {
       IdealState is = idealStateMap.get(resourceName);
-      if (!activeAssignment.containsKey(resourceName)) {
+      if (!activeIdealStates.containsKey(resourceName)) {
         throw new HelixRebalanceException(
             "Failed to calculate the complete partition assignment with all 
active nodes. Cannot find the resource assignment for "
-                + resourceName,
-            HelixRebalanceException.Type.FAILED_TO_CALCULATE);
+                + resourceName, 
HelixRebalanceException.Type.FAILED_TO_CALCULATE);
       }
+      IdealState newActiveIdealState = activeIdealStates.get(resourceName);
 
 Review comment:
   In this context, these objects are IdealState objects. If I call it mapping, 
then others may ask why we name an IdealState object with "mapping" or 
"preferenceList".
   
   I know delayed rebalancer uses a different system to name these things. If I 
follow that rule in the WAGED rebalancer, some of them do not make much sense 
since the logic is different. We are trying to distinguish and also stick with 
the name "best possible **assignment**" and the "**ideal state**" in the WAGED 
rebalancer. In the other rebalancer, the two are not clearly defined. Sometime 
mixed-used.
   
   I have added some comments, I believe it is clearer now.

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

Reply via email to