You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by rm...@apache.org on 2025/04/15 13:25:58 UTC

(hbase) 01/01: HBASE-29262 StochasticLoadBalancer should use the CostFunction epsilon when evaluating whether a move improved costs (#6907)

This is an automated email from the ASF dual-hosted git repository.

rmattingly pushed a commit to branch HBASE-29262-branch-3
in repository https://gitbox.apache.org/repos/asf/hbase.git

commit 6eb445d375e5329f443266183d4f6d810e1def42
Author: Ray Mattingly <rm...@apache.org>
AuthorDate: Tue Apr 15 09:24:43 2025 -0400

    HBASE-29262 StochasticLoadBalancer should use the CostFunction epsilon when evaluating whether a move improved costs (#6907)
    
    Co-authored-by: Ray Mattingly <rm...@hubspot.com>
    Signed-off-by: Nick Dimiduk <nd...@apache.org>
---
 .../apache/hadoop/hbase/master/balancer/StochasticLoadBalancer.java | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/hbase-balancer/src/main/java/org/apache/hadoop/hbase/master/balancer/StochasticLoadBalancer.java b/hbase-balancer/src/main/java/org/apache/hadoop/hbase/master/balancer/StochasticLoadBalancer.java
index 6139fc055eb..075d970fc69 100644
--- a/hbase-balancer/src/main/java/org/apache/hadoop/hbase/master/balancer/StochasticLoadBalancer.java
+++ b/hbase-balancer/src/main/java/org/apache/hadoop/hbase/master/balancer/StochasticLoadBalancer.java
@@ -683,8 +683,12 @@ public class StochasticLoadBalancer extends BaseLoadBalancer {
 
       newCost = computeCost(cluster, currentCost);
 
+      double costImprovement = currentCost - newCost;
+      double minimumImprovement =
+        Math.max(CostFunction.getCostEpsilon(currentCost), CostFunction.getCostEpsilon(newCost));
+      boolean costsImproved = costImprovement > minimumImprovement;
       boolean conditionalsSimilarCostsImproved =
-        (newCost < currentCost && conditionalViolationsChange == 0 && !isViolatingConditionals);
+        (costsImproved && conditionalViolationsChange == 0 && !isViolatingConditionals);
       // Our first priority is to reduce conditional violations
       // Our second priority is to reduce balancer cost
       // change, regardless of cost change