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



##########
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:
       Ideally, we would report every resource. But currently for those non 
WAGED resources, validation won't pass and `HelixException` would be thrown. So 
we'll skip non WAGED resources here. 

##########
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:
       Ideally, replacing those places with this API should be done in another 
PR. Since you've pointed out that place, I just made the change. If there are 
more places, let's make the change in another PR.




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