HBASE-12762 Region with no hfiles will have the highest locality cost in LocalityCostFunction (cuijianwei)

This commit is contained in:
stack 2014-12-29 07:44:46 -08:00
parent 882f4c9761
commit 0e39b8b9f7
1 changed files with 3 additions and 1 deletions

View File

@ -1026,7 +1026,9 @@ public class StochasticLoadBalancer extends BaseLoadBalancer {
} }
if (index < 0) { if (index < 0) {
cost += 1; if (regionLocations.length > 0) {
cost += 1;
}
} else { } else {
cost += (double) index / (double) regionLocations.length; cost += (double) index / (double) regionLocations.length;
} }