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/07/14 21:50:36 UTC

[GitHub] [helix] jiajunwang commented on a change in pull request #1151: Fix enableWagedRebalance by respecting resource names argument

jiajunwang commented on a change in pull request #1151:
URL: https://github.com/apache/helix/pull/1151#discussion_r454664554



##########
File path: helix-core/src/main/java/org/apache/helix/manager/zk/ZKHelixAdmin.java
##########
@@ -1861,23 +1861,25 @@ public boolean enableWagedRebalance(String clusterName, List<String> resourceNam
     HelixDataAccessor accessor =
         new ZKHelixDataAccessor(clusterName, new ZkBaseDataAccessor<>(_zkClient));
     PropertyKey.Builder keyBuilder = accessor.keyBuilder();
-    List<IdealState> idealStates = accessor.getChildValues(keyBuilder.idealStates(), true);
+    List<IdealState> idealStates = new ArrayList<>();
+    List<PropertyKey> idealStateKeys = new ArrayList<>();
     List<String> nullIdealStates = new ArrayList<>();

Review comment:
       I don't think we need this list, just throw the exception on the first null IS.

##########
File path: helix-core/src/main/java/org/apache/helix/manager/zk/ZKHelixAdmin.java
##########
@@ -1861,23 +1861,25 @@ public boolean enableWagedRebalance(String clusterName, List<String> resourceNam
     HelixDataAccessor accessor =
         new ZKHelixDataAccessor(clusterName, new ZkBaseDataAccessor<>(_zkClient));
     PropertyKey.Builder keyBuilder = accessor.keyBuilder();
-    List<IdealState> idealStates = accessor.getChildValues(keyBuilder.idealStates(), true);
+    List<IdealState> idealStates = new ArrayList<>();
+    List<PropertyKey> idealStateKeys = new ArrayList<>();
     List<String> nullIdealStates = new ArrayList<>();
-    for (int i = 0; i < idealStates.size(); i++) {
-      if (idealStates.get(i) == null) {
-        nullIdealStates.add(resourceNames.get(i));
+    for (String resourceName : resourceNames) {
+      PropertyKey key = keyBuilder.idealStates(resourceName);
+      IdealState idealState = accessor.getProperty(key);

Review comment:
       The original batch call is more efficient. Why do we want to change it?
   You can still iterate the returned IS list but filter by the resourceNames list. Then check if any item in the resourceNames but not in the returned IS list.




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