Skip to content

Commit d1b6415

Browse files
rmdmattinglyRay Mattingly
andauthored
HBASE-29262 StochasticLoadBalancer should use the CostFunction epsilon when evaluating whether a move improved costs (#6907) (#6908)
Signed-off-by: Nick Dimiduk <ndimiduk@apache.org> Co-authored-by: Ray Mattingly <rmattingly@hubspot.com>
1 parent aba28b7 commit d1b6415

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

hbase-balancer/src/main/java/org/apache/hadoop/hbase/master/balancer/StochasticLoadBalancer.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -683,8 +683,12 @@ protected List<RegionPlan> balanceTable(TableName tableName,
683683

684684
newCost = computeCost(cluster, currentCost);
685685

686+
double costImprovement = currentCost - newCost;
687+
double minimumImprovement =
688+
Math.max(CostFunction.getCostEpsilon(currentCost), CostFunction.getCostEpsilon(newCost));
689+
boolean costsImproved = costImprovement > minimumImprovement;
686690
boolean conditionalsSimilarCostsImproved =
687-
(newCost < currentCost && conditionalViolationsChange == 0 && !isViolatingConditionals);
691+
(costsImproved && conditionalViolationsChange == 0 && !isViolatingConditionals);
688692
// Our first priority is to reduce conditional violations
689693
// Our second priority is to reduce balancer cost
690694
// change, regardless of cost change

0 commit comments

Comments
 (0)