Skip to content

Commit 0b7c5b9

Browse files
rmdmattinglyRay Mattingly
authored andcommitted
HubSpot Backport: HBASE-29262 StochasticLoadBalancer should use the CostFunction epsilon when evaluating whether a move improved costs (apache#6907) (will be in 2.7) (#174)
Signed-off-by: Nick Dimiduk <ndimiduk@apache.org> Co-authored-by: Ray Mattingly <rmattingly@hubspot.com>
1 parent a59873c commit 0b7c5b9

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

hbase-server/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
@@ -730,8 +730,12 @@ protected List<RegionPlan> balanceTable(TableName tableName,
730730

731731
newCost = computeCost(cluster, currentCost);
732732

733+
double costImprovement = currentCost - newCost;
734+
double minimumImprovement =
735+
Math.max(CostFunction.getCostEpsilon(currentCost), CostFunction.getCostEpsilon(newCost));
736+
boolean costsImproved = costImprovement > minimumImprovement;
733737
boolean conditionalsSimilarCostsImproved =
734-
(newCost < currentCost && conditionalViolationsChange == 0 && !isViolatingConditionals);
738+
(costsImproved && conditionalViolationsChange == 0 && !isViolatingConditionals);
735739
// Our first priority is to reduce conditional violations
736740
// Our second priority is to reduce balancer cost
737741
// change, regardless of cost change

0 commit comments

Comments
 (0)