hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From st...@apache.org
Subject svn commit: r1136629 - in /hbase/trunk: CHANGES.txt src/main/java/org/apache/hadoop/hbase/master/LoadBalancer.java
Date Thu, 16 Jun 2011 19:51:34 GMT
Author: stack
Date: Thu Jun 16 19:51:34 2011
New Revision: 1136629

URL: http://svn.apache.org/viewvc?rev=1136629&view=rev
Log:
HBASE-3985 Same Region could be picked out twice in LoadBalance

Modified:
    hbase/trunk/CHANGES.txt
    hbase/trunk/src/main/java/org/apache/hadoop/hbase/master/LoadBalancer.java

Modified: hbase/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hbase/trunk/CHANGES.txt?rev=1136629&r1=1136628&r2=1136629&view=diff
==============================================================================
--- hbase/trunk/CHANGES.txt (original)
+++ hbase/trunk/CHANGES.txt Thu Jun 16 19:51:34 2011
@@ -331,6 +331,8 @@ Release 0.90.4 - Unreleased
                hmaster becomes the active one (Jieshan Bean)
    HBASE-3916  Fix the default bind address of ThriftServer to be wildcard
                instead of localhost. (Li Pi)
+   HBASE-3985  Same Region could be picked out twice in LoadBalance
+               (Jieshan Bean)
 
   IMPROVEMENT
    HBASE-3882  hbase-config.sh needs to be updated so it can auto-detects the

Modified: hbase/trunk/src/main/java/org/apache/hadoop/hbase/master/LoadBalancer.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/master/LoadBalancer.java?rev=1136629&r1=1136628&r2=1136629&view=diff
==============================================================================
--- hbase/trunk/src/main/java/org/apache/hadoop/hbase/master/LoadBalancer.java (original)
+++ hbase/trunk/src/main/java/org/apache/hadoop/hbase/master/LoadBalancer.java Thu Jun 16
19:51:34 2011
@@ -222,6 +222,7 @@ public class LoadBalancer {
     NavigableMap<ServerAndLoad, List<HRegionInfo>> serversByLoad =
       new TreeMap<ServerAndLoad, List<HRegionInfo>>();
     int numRegions = 0;
+    StringBuilder strBalanceParam = new StringBuilder("Server information: ");
     // Iterate so we can count regions as we build the map
     for (Map.Entry<ServerName, List<HRegionInfo>> server: clusterState.entrySet())
{
       List<HRegionInfo> regions = server.getValue();
@@ -229,7 +230,12 @@ public class LoadBalancer {
       if (sz == 0) emptyRegionServerPresent = true;
       numRegions += sz;
       serversByLoad.put(new ServerAndLoad(server.getKey(), sz), regions);
+      strBalanceParam.append(server.getKey().getServerName()).append("=").
+        append(server.getValue().size()).append(", ");
     }
+    strBalanceParam.delete(strBalanceParam.length() - 2,
+      strBalanceParam.length());
+    LOG.debug(strBalanceParam.toString());
 
     // Check if we even need to do any load balancing
     float average = (float)numRegions / numServers; // for logging
@@ -249,6 +255,13 @@ public class LoadBalancer {
     int min = numRegions / numServers;
     int max = numRegions % numServers == 0 ? min : min + 1;
 
+    // Using to check banance result.
+    strBalanceParam.delete(0, strBalanceParam.length());
+    strBalanceParam.append("Balance parameter: numRegions=").append(numRegions)
+        .append(", numServers=").append(numServers).append(", max=").append(max)
+        .append(", min=").append(min);
+    LOG.debug(strBalanceParam.toString());
+    
     // Balance the cluster
     // TODO: Look at data block locality or a more complex load to do this
     MinMaxPriorityQueue<RegionPlan> regionsToMove =



Mime
View raw message