jiajunwang opened a new issue #772: Unexpected randomness in the WAGED 
rebalancer partition assignment
URL: https://github.com/apache/helix/issues/772
 
 
   One problem we noticed in the test is that the Baseline and Best possible 
assignment diverge dramatically when a single resource is scaled up or down. 
One of the most possible root causes is some unexpected randomness in the 
algorithm so the baseline and best possible assignment are calculated in a 
slightly different way.
   Based on my current investigation, this is caused by a tie evaluation score. 
For example, when we scale down a resource from 2 replicas to 1 replica, the 
algorithm finds 2 potential locations (from the previous assignment) with the 
same evaluation score. It is possible that the baseline calculation chooses 
placement A and the best possible calculation chooses placement B.
   
   To address this problem, the following code in the 
ConstraintBasedAlgorithm.java is most related.
   
   >     return candidateNodes.parallelStream().map(node -> new 
HashMap.SimpleEntry<>(node,
   >         getAssignmentNormalizedScore(node, replica, clusterContext)))
   >         .max((nodeEntry1, nodeEntry2) -> {
   >           int scoreCompareResult = 
nodeEntry1.getValue().compareTo(nodeEntry2.getValue());
   >           if (scoreCompareResult == 0) {
   >             // If the evaluation scores of 2 nodes are the same, the 
algorithm assigns the replica
   >             // to the idle node first.
   >             int idleScore1 = 
busyInstances.contains(nodeEntry1.getKey().getInstanceName()) ? 0 : 1;
   >             int idleScore2 = 
busyInstances.contains(nodeEntry2.getKey().getInstanceName()) ? 0 : 1;
   >             return idleScore1 - idleScore2;
   >           } else {
   >             return scoreCompareResult;
   >           }
   >         }).map(Map.Entry::getKey);
   
   We need to sort the candidates even their scores and isBusy flags are all 
equal.

----------------------------------------------------------------
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]

Reply via email to