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 2020/10/13 06:58:44 UTC

[GitHub] [helix] pkuwm opened a new pull request #1464: Fix MaxCapacityUsageGauge value not updated

pkuwm opened a new pull request #1464:
URL: https://github.com/apache/helix/pull/1464


   ### Issues
   
   - [ ] My PR addresses the following Helix issues and references them in the PR description:
   
   Fixes #1463 
   
   ### Description
   
   - [ ] Here are some details about my PR, including screenshots of any UI changes:
   
   MaxCapacityUsageGauge value not updated because the resourcesToMonitor map is empty.
   
   This PR fixes the bug and also add an integration test to protect the metrics reporting logic.
   
   ### Tests
   
   - [ ] The following tests are written for this issue:
   
   testInstanceCapacityMetrics()
   
   - [ ] The following is the result of the "mvn test" command on the appropriate module:
   
   Running...
   
   ### Documentation (Optional)
   
   - In case of new functionality, my PR adds documentation in the following wiki page:
   
   (Link the GitHub wiki you added)
   
   ### Commits
   
   - My commits all reference appropriate Apache Helix GitHub issues in their subject lines. In addition, my commits follow the guidelines from "[How to write a good git commit message](http://chris.beams.io/posts/git-commit/)":
     1. Subject is separated from body by a blank line
     1. Subject is limited to 50 characters (not including Jira issue reference)
     1. Subject does not end with a period
     1. Subject uses the imperative mood ("add", not "adding")
     1. Body wraps at 72 characters
     1. Body explains "what" and "why", not "how"
   
   ### Code Quality
   
   - My diff has been formatted using helix-style.xml 
   (helix-style-intellij.xml if IntelliJ IDE is 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:
users@infra.apache.org



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


[GitHub] [helix] pkuwm merged pull request #1464: Fix MaxCapacityUsageGauge value not updated

Posted by GitBox <gi...@apache.org>.
pkuwm merged pull request #1464:
URL: https://github.com/apache/helix/pull/1464


   


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


[GitHub] [helix] pkuwm commented on a change in pull request #1464: Fix MaxCapacityUsageGauge value not updated

Posted by GitBox <gi...@apache.org>.
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. 
   FYI, did a quick search, no other places are found. We should be good 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:
users@infra.apache.org



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


[GitHub] [helix] pkuwm commented on a change in pull request #1464: Fix MaxCapacityUsageGauge value not updated

Posted by GitBox <gi...@apache.org>.
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:
users@infra.apache.org



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


[GitHub] [helix] NealSun96 commented on a change in pull request #1464: Fix MaxCapacityUsageGauge value not updated

Posted by GitBox <gi...@apache.org>.
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:
users@infra.apache.org



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


[GitHub] [helix] pkuwm commented on pull request #1464: Fix MaxCapacityUsageGauge value not updated

Posted by GitBox <gi...@apache.org>.
pkuwm commented on pull request #1464:
URL: https://github.com/apache/helix/pull/1464#issuecomment-707924672


   This PR is ready to be merged, approved by @NealSun96 @jiajunwang 
   
   MaxCapacityUsageGauge value not updated because the resourcesToMonitor map is empty.
   
   This commit fixes the bug and also adds an integration test to protect the metrics reporting logic.


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