From 3067e60c39e63580bfa7a5d414eb5a213b0c476c Mon Sep 17 00:00:00 2001 From: Michael Stack Date: Tue, 18 Sep 2012 21:46:04 +0000 Subject: [PATCH] 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 --- .../hbase/master/balancer/StochasticLoadBalancer.java | 11 +++-------- 1 file changed, 3 insertions(+), 8 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 af5ddf22cec..3d783a8a077 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 @@ -512,14 +512,14 @@ public class StochasticLoadBalancer extends BaseLoadBalancer { // 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. - for (String tableName : tableRegionsOnCurrentServer.keySet()) { - Integer thisCount = tableRegionsOnCurrentServer.get(tableName).toInteger(); + for (Entry currentServerEntry: tableRegionsOnCurrentServer.entrySet()) { + String tableName = currentServerEntry.getKey(); + Integer thisCount = currentServerEntry.getValue().toInteger(); Integer maxCountSoFar = tableCostSeenSoFar.get(tableName); if (maxCountSoFar == null || thisCount.compareTo(maxCountSoFar) > 0) { tableCostSeenSoFar.put(tableName, thisCount); } - } } @@ -560,11 +560,6 @@ public class StochasticLoadBalancer extends BaseLoadBalancer { max += 1; - // Only compute the data locality for moved regions. - if (initialRegionMapping.equals(sn)) { - continue; - } - List dataOnServers = regionFinder.getTopBlockLocations(region); // If we can't find where the data is getTopBlock returns null.