jiajunwang commented on a change in pull request #535: Adjust the replica
rebalance calculating ordering method to avoid a static order.
URL: https://github.com/apache/helix/pull/535#discussion_r339755023
##########
File path:
helix-core/src/main/java/org/apache/helix/controller/rebalancer/waged/constraints/ConstraintBasedAlgorithm.java
##########
@@ -162,12 +162,19 @@ private double
getAssignmentNormalizedScore(AssignableNode node, AssignableRepli
int statePriority1 = replica1.getStatePriority();
int statePriority2 = replica2.getStatePriority();
if (statePriority1 == statePriority2) {
- // If state prioritizes are the same, compare the names.
- if (resourceName1.equals(resourceName2)) {
- return
replica1.getPartitionName().compareTo(replica2.getPartitionName());
- } else {
- return resourceName1.compareTo(resourceName2);
- }
+ // If state prioritizes are the same, try to randomize the
replicas order. Otherwise,
+ // the same replicas might always be moved in the rebalance. This
is because their
+ // rebalance calculating will always happen at the critical moment
while the cluster is
+ // almost full.
Review comment:
I see.
The thing is that we still need a stable order given the TOPOLOGY is the
same. But, we don't want a fixed order for the WAGED rebalancer.
Because of the greedy algorithm, there always be an unstable window while we
try to place the replica one by one. For example, if you have 10 replicas to be
assigned, usually, the rebalancer always tries to move replica 9,10. If we have
a fixed order, the same replica will be moved again and again. And due to the
new placement tend to be unstable, this double the possibility that the
replicas being moved. So as a result, these replicas will almost be certain to
be moved again in the next round of rebalance. That, as I noted in the
comments, makes the assignment unstable.
The details are hard to note down in the comments. I plan to explain later
in some blogs in detail.
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]