Details
Description
The balancer does not fully respect the maxMovePercent configuration.
Specifically, if the number of regions being moved is less than 600, the balancer currently allows that number of region moves regardless of what value is set for maxMovePercent.
This patch fixes that behavior and simplifies the moveCost function as well. In addition, this patch adds short-circuiting logic to the balancer to terminate early once the maximum number of moves are reached (and assuming the new plan has enough of a cost improvement).