You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@helix.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2016/09/15 15:26:20 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=15493656#comment-15493656 ] 

ASF GitHub Bot commented on HELIX-631:
--------------------------------------

GitHub user lei-xia opened a pull request:

    https://github.com/apache/helix/pull/52

    [HELIX-631] AutoRebalanceStrategy does not work correctly all the time.

    What happened here is: Helix always assigns a random node for a new (unassigned) replica (logic in assignOrphans()), and then try to move it to its preferred node later. The random node chosen is based on the hashing of replica name. Given a specific partition name and number of replicas, there could be a case that no node can be found for a replica.
    
    The fix is to always assign its preferred node to a new replica unless that node is full, then randomly find another non-preferred node.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/lei-xia/helix helix-0.6.x

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/helix/pull/52.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #52
    
----
commit 2c6df69d7206b2e64902c84842c61571315e30fa
Author: Lei Xia <lx...@linkedin.com>
Date:   2016-09-13T00:54:40Z

    [HELIX-631] AutoRebalanceStrategy does not work correctly all the time.

----


> 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
>
> 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.4#6332)