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

2018-01-25 Thread Hudson (JIRA)

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

Hudson commented on HELIX-631:
--

FAILURE: Integrated in Jenkins build helix #1393 (See 
[https://builds.apache.org/job/helix/1393/])
Temporary disable logging rebalance error before HELIX-631 is resolved. (jxue: 
rev 401ada6391883f5cfcd7e04858dc94ee2b227ff7)
* (edit) 
helix-core/src/main/java/org/apache/helix/controller/stages/BestPossibleStateCalcStage.java
* (edit) 
helix-core/src/test/java/org/apache/helix/integration/rebalancer/TestPauseClusterWhenReachingOfflineInstancesLimit.java
* (edit) 
helix-core/src/test/java/org/apache/helix/integration/TestAlertingRebalancerFailure.java


> 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: Junkai Xue
>Priority: Major
> Fix For: 0.6.8
>
>
> 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 instanceNames = null; // Initialize to 4 unique strings
> final int nReplicas = 3;
> List partitions = new ArrayList<>(nPartitions);
> for (int i = 0; i < nPartitions; i++) {
>   partitions.add(Integer.toString(i));
> }
> LinkedHashMap 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>(0), instanceNames);
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


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

2017-05-09 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on HELIX-631:
--

GitHub user dasahcc opened a pull request:

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

[HELIX-631] Fix AutoRebalanceStrategy replica not assigned

In our current AutoRebalanceStrategy, Helix uses greedy algorithm to assign 
replicas. With the constraint that two replicas from same partition should not 
assigned to same node and nodes' capacity calculated by evenly distributed. 
Thus there may some replicas are not assigned.

With this fix, Helix will try to force assign the orphaned replicas to the 
node with minimum overload. This may cause imbalanced assignment.

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

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

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

https://github.com/apache/helix/pull/90.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 #90






> 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: Junkai Xue
> 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 instanceNames = null; // Initialize to 4 unique strings
> final int nReplicas = 3;
> List partitions = new ArrayList<>(nPartitions);
> for (int i = 0; i < nPartitions; i++) {
>   partitions.add(Integer.toString(i));
> }
> LinkedHashMap 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>(0), instanceNames);
> {code}



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


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

2017-04-10 Thread Subbu (JIRA)

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

Subbu commented on HELIX-631:
-

Sorry I did not specify the test case fully.

Please try it with 16 partitions, 6 instances and 3 replicas.

You will see that partition 9 has only 2 replicas assigned to 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: Junkai Xue
> 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 instanceNames = null; // Initialize to 4 unique strings
> final int nReplicas = 3;
> List partitions = new ArrayList<>(nPartitions);
> for (int i = 0; i < nPartitions; i++) {
>   partitions.add(Integer.toString(i));
> }
> LinkedHashMap 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>(0), instanceNames);
> {code}



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


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

2017-04-10 Thread Junkai Xue (JIRA)

[ 
https://issues.apache.org/jira/browse/HELIX-631?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=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 instanceNames = null; // Initialize to 4 unique strings
> final int nReplicas = 3;
> List partitions = new ArrayList<>(nPartitions);
> for (int i = 0; i < nPartitions; i++) {
>   partitions.add(Integer.toString(i));
> }
> LinkedHashMap 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>(0), instanceNames);
> {code}



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


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

2016-09-28 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on HELIX-631:
--

Github user lei-xia commented on the issue:

https://github.com/apache/helix/pull/52
  
Yes, the tests passed.


> 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 instanceNames = null; // Initialize to 4 unique strings
> final int nReplicas = 3;
> List partitions = new ArrayList<>(nPartitions);
> for (int i = 0; i < nPartitions; i++) {
>   partitions.add(Integer.toString(i));
> }
> LinkedHashMap 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>(0), instanceNames);
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


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

2016-09-28 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on HELIX-631:
--

Github user lei-xia commented on a diff in the pull request:

https://github.com/apache/helix/pull/52#discussion_r81051316
  
--- Diff: 
helix-core/src/main/java/org/apache/helix/controller/rebalancer/strategy/AutoRebalanceStrategy.java
 ---
@@ -177,15 +176,26 @@ private void assignOrphans() {
 while (it.hasNext()) {
   Replica replica = it.next();
   boolean added = false;
-  int startIndex = computeRandomStartIndex(replica);
-  for (int index = startIndex; index < startIndex + 
_liveNodesList.size(); index++) {
-Node receiver = _liveNodesList.get(index % _liveNodesList.size());
-if (receiver.capacity > receiver.currentlyAssigned && 
receiver.canAdd(replica)) {
-  receiver.currentlyAssigned = receiver.currentlyAssigned + 1;
-  receiver.nonPreferred.add(replica);
-  receiver.newReplicas.add(replica);
-  added = true;
-  break;
+
+  // first find if it preferred node still has capacity
+  Node preferred = _preferredAssignment.get(replica);
+  if (preferred.capacity > preferred.currentlyAssigned && 
preferred.canAdd(replica)) {
--- End diff --

Fixed, refactored to a separated method.


> 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 instanceNames = null; // Initialize to 4 unique strings
> final int nReplicas = 3;
> List partitions = new ArrayList<>(nPartitions);
> for (int i = 0; i < nPartitions; i++) {
>   partitions.add(Integer.toString(i));
> }
> LinkedHashMap 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>(0), instanceNames);
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


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

2016-09-28 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on HELIX-631:
--

Github user lei-xia commented on a diff in the pull request:

https://github.com/apache/helix/pull/52#discussion_r81051293
  
--- Diff: 
helix-core/src/main/java/org/apache/helix/controller/rebalancer/strategy/AutoRebalanceStrategy.java
 ---
@@ -129,9 +129,8 @@ public ZNRecord computePartitionAssignment(final 
List allNodes, final Li
   logger.info("orphan = " + _orphaned);
 }
 
-moveNonPreferredReplicasToPreferred();
-
 assignOrphans();
+moveNonPreferredReplicasToPreferred();
--- End diff --

Because assignOrphans() will also assign some new partitions to 
non-preferred nodes.



> 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 instanceNames = null; // Initialize to 4 unique strings
> final int nReplicas = 3;
> List partitions = new ArrayList<>(nPartitions);
> for (int i = 0; i < nPartitions; i++) {
>   partitions.add(Integer.toString(i));
> }
> LinkedHashMap 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>(0), instanceNames);
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


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

2016-09-22 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on HELIX-631:
--

Github user kanakb commented on a diff in the pull request:

https://github.com/apache/helix/pull/52#discussion_r80157339
  
--- Diff: 
helix-core/src/main/java/org/apache/helix/controller/rebalancer/strategy/AutoRebalanceStrategy.java
 ---
@@ -129,9 +129,8 @@ public ZNRecord computePartitionAssignment(final 
List allNodes, final Li
   logger.info("orphan = " + _orphaned);
 }
 
-moveNonPreferredReplicasToPreferred();
-
 assignOrphans();
+moveNonPreferredReplicasToPreferred();
--- End diff --

Why did you switch this order?


> 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 instanceNames = null; // Initialize to 4 unique strings
> final int nReplicas = 3;
> List partitions = new ArrayList<>(nPartitions);
> for (int i = 0; i < nPartitions; i++) {
>   partitions.add(Integer.toString(i));
> }
> LinkedHashMap 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>(0), instanceNames);
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


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

2016-09-22 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on HELIX-631:
--

Github user kanakb commented on a diff in the pull request:

https://github.com/apache/helix/pull/52#discussion_r80157395
  
--- Diff: 
helix-core/src/main/java/org/apache/helix/controller/rebalancer/strategy/AutoRebalanceStrategy.java
 ---
@@ -177,15 +176,26 @@ private void assignOrphans() {
 while (it.hasNext()) {
   Replica replica = it.next();
   boolean added = false;
-  int startIndex = computeRandomStartIndex(replica);
-  for (int index = startIndex; index < startIndex + 
_liveNodesList.size(); index++) {
-Node receiver = _liveNodesList.get(index % _liveNodesList.size());
-if (receiver.capacity > receiver.currentlyAssigned && 
receiver.canAdd(replica)) {
-  receiver.currentlyAssigned = receiver.currentlyAssigned + 1;
-  receiver.nonPreferred.add(replica);
-  receiver.newReplicas.add(replica);
-  added = true;
-  break;
+
+  // first find if it preferred node still has capacity
+  Node preferred = _preferredAssignment.get(replica);
+  if (preferred.capacity > preferred.currentlyAssigned && 
preferred.canAdd(replica)) {
--- End diff --

Can you refactor this into a method, since this is basically the same code 
as below?


> 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 instanceNames = null; // Initialize to 4 unique strings
> final int nReplicas = 3;
> List partitions = new ArrayList<>(nPartitions);
> for (int i = 0; i < nPartitions; i++) {
>   partitions.add(Integer.toString(i));
> }
> LinkedHashMap 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>(0), instanceNames);
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


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

2016-09-15 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/HELIX-631?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=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 
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 instanceNames = null; // Initialize to 4 unique strings
> final int nReplicas = 3;
> List partitions = new ArrayList<>(nPartitions);
> for (int i = 0; i < nPartitions; i++) {
>   partitions.add(Integer.toString(i));
> }
> LinkedHashMap 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>(0), instanceNames);
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


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

2016-08-25 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on HELIX-631:
--

Github user kishoreg commented on the issue:

https://github.com/apache/helix/pull/48
  
@lei-xia can you also review this change. Subbu had a test case 
https://issues.apache.org/jira/browse/HELIX-631. Will be good to see if this 
change fixes that as well.


> 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 instanceNames = null; // Initialize to 4 unique strings
> final int nReplicas = 3;
> List partitions = new ArrayList<>(nPartitions);
> for (int i = 0; i < nPartitions; i++) {
>   partitions.add(Integer.toString(i));
> }
> LinkedHashMap 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>(0), instanceNames);
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


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

2016-08-09 Thread Lei Xia (JIRA)

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

Lei Xia commented on HELIX-631:
---

Confirmed that this can be reproduced.  The following preference list was 
generated (with partition 9 missing one replica).

{0=[node-1, node-2, node-3], 
1=[node-4, node-2, node-3], 
10=[node-1, node-4, node-2], 
11=[node-1, node-3, node-2], 
12=[node-4, node-3, node-2], 
13=[node-1, node-4, node-3], 
14=[node-1, node-4, node-2], 
15=[node-1, node-3, node-2], 
2=[node-4, node-1, node-3], 
3=[node-4, node-1, node-2],
 4=[node-3, node-1, node-2], 
5=[node-4, node-3, node-2], 
6=[node-4, node-1, node-3],
7=[node-4, node-1, node-2], 
8=[node-3, node-1, node-2], 
9=[node-4, node-3]}

> 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
>
> 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 instanceNames = null; // Initialize to 4 unique strings
> final int nReplicas = 3;
> List partitions = new ArrayList<>(nPartitions);
> for (int i = 0; i < nPartitions; i++) {
>   partitions.add(Integer.toString(i));
> }
> LinkedHashMap 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>(0), instanceNames);
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)