HBASE-6779 Fix issues analysis.apache.org raises about StochasticLoadBalancer

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1387372 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Stack 2012-09-18 21:46:04 +00:00
parent 4bd1ffbd1e
commit 3067e60c39
1 changed files with 3 additions and 8 deletions

View File

@ -512,14 +512,14 @@ public class StochasticLoadBalancer extends BaseLoadBalancer {
// Now go through all of the tables we have seen and keep the max number // Now go through all of the tables we have seen and keep the max number
// of regions of this table a single region server is hosting. // of regions of this table a single region server is hosting.
for (String tableName : tableRegionsOnCurrentServer.keySet()) { for (Entry<String, MutableInt> currentServerEntry: tableRegionsOnCurrentServer.entrySet()) {
Integer thisCount = tableRegionsOnCurrentServer.get(tableName).toInteger(); String tableName = currentServerEntry.getKey();
Integer thisCount = currentServerEntry.getValue().toInteger();
Integer maxCountSoFar = tableCostSeenSoFar.get(tableName); Integer maxCountSoFar = tableCostSeenSoFar.get(tableName);
if (maxCountSoFar == null || thisCount.compareTo(maxCountSoFar) > 0) { if (maxCountSoFar == null || thisCount.compareTo(maxCountSoFar) > 0) {
tableCostSeenSoFar.put(tableName, thisCount); tableCostSeenSoFar.put(tableName, thisCount);
} }
} }
} }
@ -560,11 +560,6 @@ public class StochasticLoadBalancer extends BaseLoadBalancer {
max += 1; max += 1;
// Only compute the data locality for moved regions.
if (initialRegionMapping.equals(sn)) {
continue;
}
List<ServerName> dataOnServers = regionFinder.getTopBlockLocations(region); List<ServerName> dataOnServers = regionFinder.getTopBlockLocations(region);
// If we can't find where the data is getTopBlock returns null. // If we can't find where the data is getTopBlock returns null.