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 fc5939e7dd0..4d04282b1ba 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;