HBASE-26297 Balancer run is improperly triggered by accuracy error of double comparison (#3698)

Signed-off-by: Duo Zhang <zhangduo@apache.org>
This commit is contained in:
clarax 2021-09-26 00:10:44 -07:00 committed by Duo Zhang
parent 49ae675275
commit 73f42b27bf
1 changed files with 2 additions and 2 deletions

View File

@ -295,11 +295,11 @@ public class StochasticLoadBalancer extends BaseLoadBalancer {
private boolean areSomeRegionReplicasColocated(BalancerClusterState c) { private boolean areSomeRegionReplicasColocated(BalancerClusterState c) {
regionReplicaHostCostFunction.prepare(c); regionReplicaHostCostFunction.prepare(c);
if (regionReplicaHostCostFunction.cost() > 0) { if (Math.abs(regionReplicaHostCostFunction.cost()) > CostFunction.COST_EPSILON) {
return true; return true;
} }
regionReplicaRackCostFunction.prepare(c); regionReplicaRackCostFunction.prepare(c);
if (regionReplicaRackCostFunction.cost() > 0) { if (Math.abs(regionReplicaRackCostFunction.cost()) > CostFunction.COST_EPSILON) {
return true; return true;
} }
return false; return false;