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

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


The following commit(s) were added to refs/heads/branch-3 by this push:
     new d1b64158815 HBASE-29262 StochasticLoadBalancer should use the 
CostFunction epsilon when evaluating whether a move improved costs (#6907) 
(#6908)
d1b64158815 is described below

commit d1b64158815f2966854796dab3f048a149e3aceb
Author: Ray Mattingly <[email protected]>
AuthorDate: Wed Apr 16 08:52:53 2025 -0400

    HBASE-29262 StochasticLoadBalancer should use the CostFunction epsilon when 
evaluating whether a move improved costs (#6907) (#6908)
    
    Signed-off-by: Nick Dimiduk <[email protected]>
    Co-authored-by: Ray Mattingly <[email protected]>
---
 .../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

Reply via email to