You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@helix.apache.org by lx...@apache.org on 2018/03/23 18:58:13 UTC

[4/6] helix git commit: Fix a bug in AutoRebalancer that it fails to compute ideal mapping if "ANY_LIVEINSTANCE" is specified as the replica.

Fix a bug in AutoRebalancer that it fails to compute ideal mapping if "ANY_LIVEINSTANCE" is specified as the replica.


Project: http://git-wip-us.apache.org/repos/asf/helix/repo
Commit: http://git-wip-us.apache.org/repos/asf/helix/commit/42557199
Tree: http://git-wip-us.apache.org/repos/asf/helix/tree/42557199
Diff: http://git-wip-us.apache.org/repos/asf/helix/diff/42557199

Branch: refs/heads/master
Commit: 42557199a99feab1a0157569d49925f60a0955b1
Parents: 16f807a
Author: Lei Xia <lx...@linkedin.com>
Authored: Wed Mar 14 17:29:53 2018 -0700
Committer: Lei Xia <lx...@linkedin.com>
Committed: Fri Mar 23 11:57:07 2018 -0700

----------------------------------------------------------------------
 .../org/apache/helix/controller/rebalancer/AutoRebalancer.java   | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/helix/blob/42557199/helix-core/src/main/java/org/apache/helix/controller/rebalancer/AutoRebalancer.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/controller/rebalancer/AutoRebalancer.java b/helix-core/src/main/java/org/apache/helix/controller/rebalancer/AutoRebalancer.java
index 1c385dd..1af159d 100644
--- a/helix-core/src/main/java/org/apache/helix/controller/rebalancer/AutoRebalancer.java
+++ b/helix-core/src/main/java/org/apache/helix/controller/rebalancer/AutoRebalancer.java
@@ -72,10 +72,10 @@ public class AutoRebalancer extends AbstractRebalancer {
       throw new HelixException("State Model Definition null for resource: " + resourceName);
     }
     Map<String, LiveInstance> liveInstance = clusterData.getLiveInstances();
-    String replicas = currentIdealState.getReplicas();
+    int replicas = currentIdealState.getReplicaCount(liveInstance.size());
 
     LinkedHashMap<String, Integer> stateCountMap = stateModelDef
-        .getStateCountMap(liveInstance.size(), Integer.parseInt(replicas));
+        .getStateCountMap(liveInstance.size(), replicas);
     List<String> liveNodes = new ArrayList<String>(liveInstance.keySet());
     List<String> allNodes = new ArrayList<String>(clusterData.getInstanceConfigMap().keySet());
     allNodes.removeAll(clusterData.getDisabledInstances());