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 GitHub
parent 2b26dfbaf4
commit cbebf85b3c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -276,11 +276,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;