You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@helix.apache.org by "Junkai Xue (JIRA)" <ji...@apache.org> on 2017/04/10 19:11:41 UTC

[jira] [Commented] (HELIX-631) AutoRebalanceStrategy does not work correctly all the time

    [ https://issues.apache.org/jira/browse/HELIX-631?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15963368#comment-15963368 ] 

Junkai Xue commented on HELIX-631:
----------------------------------

Hi [~mcvsubbu],

I just use your code tested it. But I one thing you forgot to add is the instance names:
    for (int i = 0; i < 6; i++) {
      instanceNames.add("NODE_" + i);
    }

With this additional code, I got generated mapping:
something, {}{0={NODE_0=ONLINE, NODE_4=ONLINE, NODE_5=ONLINE}, 1={NODE_0=ONLINE, NODE_1=ONLINE, NODE_5=ONLINE}, 2={NODE_0=ONLINE, NODE_1=ONLINE, NODE_2=ONLINE}, 3={NODE_1=ONLINE, NODE_2=ONLINE, NODE_3=ONLINE}, 4={NODE_2=ONLINE, NODE_3=ONLINE, NODE_4=ONLINE}}{0=[NODE_0, NODE_4, NODE_5], 1=[NODE_1, NODE_0, NODE_5], 2=[NODE_2, NODE_1, NODE_0], 3=[NODE_3, NODE_2, NODE_1], 4=[NODE_3, NODE_4, NODE_2]}

I did not see any problem with this case. Could you please provide more details about it?



> AutoRebalanceStrategy does not work correctly all the time
> ----------------------------------------------------------
>
>                 Key: HELIX-631
>                 URL: https://issues.apache.org/jira/browse/HELIX-631
>             Project: Apache Helix
>          Issue Type: Bug
>            Reporter: Subbu
>            Assignee: Lei Xia
>             Fix For: 0.6.6
>
>
> I have 16 partitions, 3 replicas each, and 4 instances to distribute these on. The auto-rebalancer assigns only 2 replicas for one of the partitions.
> Here is the code snippet to reproduce the problem
> {code}
>     final String resourceName = "something";
>     final List<String> instanceNames = null; // Initialize to 4 unique strings
>     final int nReplicas = 3;
>     List<String> partitions = new ArrayList<>(nPartitions);
>     for (int i = 0; i < nPartitions; i++) {
>       partitions.add(Integer.toString(i));
>     }
>     LinkedHashMap<String, Integer> states = new LinkedHashMap<>(2);
>     states.put("OFFLINE", 0);
>     states.put("ONLINE", nReplicas);
>     AutoRebalanceStrategy strategy = new AutoRebalanceStrategy(resourceName, partitions, states);
>     ZNRecord znRecord = strategy.computePartitionAssignment(instanceNames, new HashMap<String, Map<String, String>>(0), instanceNames);
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)