i3wangyi commented on a change in pull request #651: Improve the algorithm so
it prioritizes the assignment to the idle nodes when the constraint evaluation
results are the same
URL: https://github.com/apache/helix/pull/651#discussion_r356821588
##########
File path:
helix-core/src/main/java/org/apache/helix/controller/rebalancer/waged/model/ClusterContext.java
##########
@@ -104,6 +106,15 @@
_estimatedMaxTopStateCount =
estimateAvgReplicaCount(totalTopStateReplicas, instanceCount);
_baselineAssignment = baselineAssignment;
_bestPossibleAssignment = bestPossibleAssignment;
+
+ _busyInstances = _bestPossibleAssignment.values().stream().flatMap(
+ resourceAssignment ->
resourceAssignment.getRecord().getMapFields().values().stream()
Review comment:
This is a bit of general advice FYI.
I feel concerned about manipulating a map of nested map data structure in
multiple places, it's in general hard to read & follow. A centralized data
model of bestPossibleAssignement, baselineAssignment, even current assignment
would be ideal. Something like
```
public class ClusterAssignment {
public xxx findDifference(ClusterAssignment other) {
}
public Set<String> getBusyInstances() {
....
}
}
ClusterAssignment bestPossible;
ClusterAssignment baseLine;
```
It would be easier to unit test and have as many as things centralized in
one place
----------------------------------------------------------------
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]