coordinator slight optimze load rule to skip drop if numToDrop is 0 (#5928)

This commit is contained in:
Clint Wylie 2018-07-03 17:56:11 -07:00 committed by Gian Merlino
parent d5a3871864
commit 0a472d3fa0
1 changed files with 5 additions and 1 deletions

View File

@ -322,7 +322,11 @@ public abstract class LoadRule implements Rule
} else {
final int currentReplicantsInTier = entry.getIntValue();
final int numToDrop = currentReplicantsInTier - targetReplicants.getOrDefault(tier, 0);
numDropped = dropForTier(numToDrop, holders, segment, params.getBalancerStrategy());
if (numToDrop > 0) {
numDropped = dropForTier(numToDrop, holders, segment, params.getBalancerStrategy());
} else {
numDropped = 0;
}
}
stats.addToTieredStat(DROPPED_COUNT, tier, numDropped);