From 386a6e87fecd2971354028cfebd4d19fd9dfe599 Mon Sep 17 00:00:00 2001 From: Sean Busbey Date: Tue, 27 Jun 2017 13:33:23 -0500 Subject: [PATCH] Revert "HBASE-18164 Fast locality computation in balancer - addendum handles NaN" This reverts commit 74e9d314749a24ecdeebecfb801416efd71c3b79. early commit missed some review feedback. --- .../hbase/master/balancer/StochasticLoadBalancer.java | 7 +++---- 1 file changed, 3 insertions(+), 4 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 419f0511312..6f99f44720e 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 @@ -1279,9 +1279,8 @@ public class StochasticLoadBalancer extends BaseLoadBalancer { } // We normalize locality to be a score between 0 and 1.0 representing how good it - // is compared to how good it could be. If bestLocality is 0, assume locality is 100 - // (and the cost is 0) - locality = bestLocality == 0 ? 1 : locality / bestLocality; + // is compared to how good it could be + locality /= bestLocality; } @Override @@ -1292,7 +1291,7 @@ public class StochasticLoadBalancer extends BaseLoadBalancer { return; } double localityDelta = getWeightedLocality(region, newEntity) - getWeightedLocality(region, oldEntity); - double normalizedDelta = bestLocality == 0 ? 0.0 : localityDelta / bestLocality; + double normalizedDelta = localityDelta / bestLocality; locality += normalizedDelta; }