kaisun2000 commented on issue #1386:
URL: https://github.com/apache/helix/issues/1386#issuecomment-697051671
```
StateTransitionThrottleConfig.RebalanceType rebalanceType =
RebalanceType.NONE;
if (partitionsNeedRecovery.contains(partition)) {
rebalanceType =
StateTransitionThrottleConfig.RebalanceType.RECOVERY_BALANCE;
} else if (partitionsNeedLoadbalance.contains(partition)) {
rebalanceType =
StateTransitionThrottleConfig.RebalanceType.LOAD_BALANCE;
}
-----> NONE can be passed in. Is it a problem ?
if (pendingMap.size() > 0) {
boolean shouldChargePartition = false;
for (String instance : pendingMap.keySet()) {
String currentState = currentStateMap.get(instance);
String pendingState = pendingMap.get(instance);
if (pendingState != null && !pendingState.equals(currentState)
&& !cache.getDisabledInstancesForPartition(resourceName,
partition.getPartitionName())
.contains(instance)) {
// Only charge this instance if the partition is not disabled
throttleController.chargeInstance(rebalanceType, instance);
shouldChargePartition = true;
// If there is a pending state transition for the partition,
that means that an assignment
// has already been made and the state transition message has
already been sent out for the partition
// in a previous pipeline run. We must honor this and reflect it
by charging for the pending state transition message.
// Since the assignment has already been made for the pending
message, we do a special treatment
// for it by setting the best possible state directly in
intermediatePartitionStateMap so that the pending
// message won't be double-assigned or double-charged in
recovery or load balance.
handlePendingStateTransitionsForThrottling(partition,
partitionsNeedRecovery,
partitionsNeedLoadbalance, rebalanceType,
bestPossiblePartitionStateMap,
intermediatePartitionStateMap);
}
}
if (shouldChargePartition) {
throttleController.chargeCluster(rebalanceType);
throttleController.chargeResource(rebalanceType, resourceName);
}
}
}
}
```
----------------------------------------------------------------
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]