Revert "HBASE-18164 Fast locality computation in balancer - addendum handles NaN"

This reverts commit b4c3fe9763.

early commit missed some review feedback.
This commit is contained in:
Sean Busbey 2017-06-27 13:31:40 -05:00
parent d5e206dfa0
commit 0ad8f26662
1 changed files with 3 additions and 4 deletions

View File

@ -1286,9 +1286,8 @@ public class StochasticLoadBalancer extends BaseLoadBalancer {
} }
// We normalize locality to be a score between 0 and 1.0 representing how good it // 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 // is compared to how good it could be
// (and the cost is 0) locality /= bestLocality;
locality = bestLocality == 0 ? 1 : locality / bestLocality;
} }
@Override @Override
@ -1299,7 +1298,7 @@ public class StochasticLoadBalancer extends BaseLoadBalancer {
return; return;
} }
double localityDelta = getWeightedLocality(region, newEntity) - getWeightedLocality(region, oldEntity); double localityDelta = getWeightedLocality(region, newEntity) - getWeightedLocality(region, oldEntity);
double normalizedDelta = bestLocality == 0 ? 0.0 : localityDelta / bestLocality; double normalizedDelta = localityDelta / bestLocality;
locality += normalizedDelta; locality += normalizedDelta;
} }