NealSun96 commented on a change in pull request #1464:
URL: https://github.com/apache/helix/pull/1464#discussion_r504107433



##########
File path: 
helix-core/src/main/java/org/apache/helix/controller/rebalancer/util/WagedValidationUtil.java
##########
@@ -88,4 +90,16 @@
     }
     return partitionCapacity;
   }
+
+  /**
+   * Checks whether or not a resource has enabled WAGED rebalancer.
+   *
+   * @param idealState {@code IdealState} of the resource being checked.
+   * @return {@code true} if WAGED is enabled; otherwise, {@code false}.
+   */
+  public static boolean isWagedEnabled(IdealState idealState) {

Review comment:
       This could be used in 
`BestPossibleStateCalcStage.computeResourceBestPossibleStateWithWagedRebalancer`
 as well. Could you check for other similar usages? Replacing those logic with 
this function is a step up for cleanness.

##########
File path: 
helix-core/src/main/java/org/apache/helix/controller/stages/CurrentStateComputationStage.java
##########
@@ -283,10 +284,10 @@ private void 
reportInstanceCapacityMetrics(ClusterStatusMonitor clusterStatusMon
     asyncExecute(dataProvider.getAsyncTasksThreadPool(), () -> {
       try {
         // ResourceToRebalance map also has resources from current states.
-        // Only use the resources in ideal states to parse all replicas.
+        // Only use the resources in ideal states that enable WAGED to parse 
all replicas.
         Map<String, IdealState> idealStateMap = dataProvider.getIdealStates();
         Map<String, Resource> resourceToMonitorMap = 
resourceMap.entrySet().stream()
-            .filter(idealStateMap::containsKey)
+            .filter(entry -> 
WagedValidationUtil.isWagedEnabled(idealStateMap.get(entry.getKey())))

Review comment:
       Is this a behavior change (all resources -> waged only)? 




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



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to