jiajunwang commented on a change in pull request #639: Refine the WAGED
rebalancer to minimize the partial rebalance workload.
URL: https://github.com/apache/helix/pull/639#discussion_r359103527
##########
File path:
helix-core/src/main/java/org/apache/helix/controller/rebalancer/waged/model/ClusterModelProvider.java
##########
@@ -154,39 +329,35 @@ public static ClusterModel
generateClusterModelFromCurrentState(
for (String resourceName : replicaMap.keySet()) {
Set<AssignableReplica> replicas = replicaMap.get(resourceName);
// 1. if the resource config/idealstate is changed, need to reassign.
- // 2. if the resource does appear in the best possible assignment,
need to reassign.
+ // 2. if the resource does appear in the current assignment, need to
reassign.
if (clusterChanges
.getOrDefault(HelixConstants.ChangeType.RESOURCE_CONFIG,
Collections.emptySet())
.contains(resourceName) || clusterChanges
.getOrDefault(HelixConstants.ChangeType.IDEAL_STATE,
Collections.emptySet())
- .contains(resourceName) ||
!bestPossibleAssignment.containsKey(resourceName)) {
+ .contains(resourceName) ||
!currentAssignment.containsKey(resourceName)) {
toBeAssignedReplicas.addAll(replicas);
continue; // go to check next resource
} else {
- // check for every best possible assignments to identify if the
related replicas need to reassign.
- ResourceAssignment assignment =
bestPossibleAssignment.get(resourceName);
- // <partition, <instance, state>>
- Map<String, Map<String, String>> stateMap =
assignment.getMappedPartitions().stream()
- .collect(Collectors.toMap(partition ->
partition.getPartitionName(),
- partition -> new
HashMap<>(assignment.getReplicaMap(partition))));
+ // check for every replication allocations to identify if the
related replicas need to reassign.
Review comment:
Updated.
----------------------------------------------------------------
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]