hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From st...@apache.org
Subject svn commit: r995679 - in /hbase/trunk: CHANGES.txt src/main/java/org/apache/hadoop/hbase/master/LoadBalancer.java
Date Fri, 10 Sep 2010 06:01:31 GMT
Author: stack
Date: Fri Sep 10 06:01:30 2010
New Revision: 995679

URL: http://svn.apache.org/viewvc?rev=995679&view=rev
Log:
HBASE-2978 LoadBalancer IndexOutOfBoundsException

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=995679&r1=995678&r2=995679&view=diff
==============================================================================
--- hbase/trunk/CHANGES.txt (original)
+++ hbase/trunk/CHANGES.txt Fri Sep 10 06:01:30 2010
@@ -517,6 +517,7 @@ Release 0.21.0 - Unreleased
    HBASE-2973  NPE in LogCleaner
    HBASE-2974  LoadBalancer ArithmeticException: / by zero
    HBASE-2975  DFSClient names in master and RS should be unique
+   HBASE-2978  LoadBalancer IndexOutOfBoundsException
 
   IMPROVEMENTS
    HBASE-1760  Cleanup TODOs in HTable

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=995679&r1=995678&r2=995679&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 Fri Sep 10
06:01:30 2010
@@ -19,8 +19,6 @@
  */
 package org.apache.hadoop.hbase.master;
 
-import java.io.DataInput;
-import java.io.DataOutput;
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Comparator;
@@ -39,7 +37,6 @@ import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.hbase.HRegionInfo;
 import org.apache.hadoop.hbase.HServerInfo;
-import org.apache.hadoop.io.Writable;
 
 /**
  * Makes decisions about the placement and movement of Regions across
@@ -131,8 +128,6 @@ public class LoadBalancer {
    */
   public List<RegionPlan> balanceCluster(
       Map<HServerInfo,List<HRegionInfo>> clusterState) {
-    LOG.debug("Running load balancer");
-
     long startTime = System.currentTimeMillis();
 
     // Make a map sorted by load and count regions
@@ -141,7 +136,7 @@ public class LoadBalancer {
           new HServerInfo.LoadComparator());
     int numServers = clusterState.size();
     if (numServers == 0) {
-      LOG.debug("numServers=0 so nothing to balance");
+      LOG.debug("numServers=0 so skipping load balancing");
       return null;
     }
     int numRegions = 0;
@@ -240,13 +235,14 @@ public class LoadBalancer {
     // Either more regions to assign out or servers that are still underloaded
 
     // If we need more to fill min, grab one from each most loaded until enough
-    if(neededRegions != 0) {
+    if (neededRegions != 0) {
       // Walk down most loaded, grabbing one from each until we get enough
       for(Map.Entry<HServerInfo, List<HRegionInfo>> server :
         serversByLoad.descendingMap().entrySet()) {
         BalanceInfo balanceInfo = serverBalanceInfo.get(server.getKey());
         int idx =
           balanceInfo == null ? 0 : balanceInfo.getNextRegionForUnload();
+        if (idx >= server.getValue().size()) break;
         HRegionInfo region = server.getValue().get(idx);
         if (region.isMetaRegion()) continue; // Don't move meta regions.
         regionsToMove.add(new RegionPlan(region, server.getKey(), null));



Mime
View raw message