You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by zh...@apache.org on 2021/09/26 15:48:26 UTC

[hbase] branch branch-2 updated: HBASE-26297 Balancer run is improperly triggered by accuracy error of double comparison (#3698)

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

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


The following commit(s) were added to refs/heads/branch-2 by this push:
     new 73f42b2  HBASE-26297 Balancer run is improperly triggered by accuracy error of double comparison (#3698)
73f42b2 is described below

commit 73f42b27bf5e5cadf3fd9655451b0ef263338d15
Author: clarax <cl...@gmail.com>
AuthorDate: Sun Sep 26 00:10:44 2021 -0700

    HBASE-26297 Balancer run is improperly triggered by accuracy error of double comparison (#3698)
    
    Signed-off-by: Duo Zhang <zh...@apache.org>
---
 .../apache/hadoop/hbase/master/balancer/StochasticLoadBalancer.java   | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/StochasticLoadBalancer.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/StochasticLoadBalancer.java
index fc5939e..4d04282 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/StochasticLoadBalancer.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/StochasticLoadBalancer.java
@@ -295,11 +295,11 @@ public class StochasticLoadBalancer extends BaseLoadBalancer {
 
   private boolean areSomeRegionReplicasColocated(BalancerClusterState c) {
     regionReplicaHostCostFunction.prepare(c);
-    if (regionReplicaHostCostFunction.cost() > 0) {
+    if (Math.abs(regionReplicaHostCostFunction.cost()) > CostFunction.COST_EPSILON) {
       return true;
     }
     regionReplicaRackCostFunction.prepare(c);
-    if (regionReplicaRackCostFunction.cost() > 0) {
+    if (Math.abs(regionReplicaRackCostFunction.cost()) > CostFunction.COST_EPSILON) {
       return true;
     }
     return false;