hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From st...@apache.org
Subject svn commit: r734482 - in /hadoop/hbase/trunk: CHANGES.txt src/java/org/apache/hadoop/hbase/master/RegionManager.java src/java/org/apache/hadoop/hbase/master/ServerManager.java
Date Wed, 14 Jan 2009 18:56:39 GMT
Author: stack
Date: Wed Jan 14 10:56:39 2009
New Revision: 734482

URL: http://svn.apache.org/viewvc?rev=734482&view=rev
Log:
HBASE-1124 Balancer kicks in way too early

Modified:
    hadoop/hbase/trunk/CHANGES.txt
    hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/master/RegionManager.java
    hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/master/ServerManager.java

Modified: hadoop/hbase/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/CHANGES.txt?rev=734482&r1=734481&r2=734482&view=diff
==============================================================================
--- hadoop/hbase/trunk/CHANGES.txt (original)
+++ hadoop/hbase/trunk/CHANGES.txt Wed Jan 14 10:56:39 2009
@@ -142,6 +142,7 @@
    HBASE-1121  Cluster confused about where -ROOT- is
    HBASE-1125  IllegalStateException: Cannot set a region to be closed if it was
                not already marked as pending close
+   HBASE-1124  Balancer kicks in way too early
 
   IMPROVEMENTS
    HBASE-901   Add a limit to key length, check key and value length on client side

Modified: hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/master/RegionManager.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/master/RegionManager.java?rev=734482&r1=734481&r2=734482&view=diff
==============================================================================
--- hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/master/RegionManager.java (original)
+++ hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/master/RegionManager.java Wed Jan
14 10:56:39 2009
@@ -167,9 +167,7 @@
   
   /*
    * Assigns regions to region servers attempting to balance the load across
-   * all region servers
-   *
-   * Note that no synchronization is necessary as the caller 
+   * all region servers. Note that no synchronization is necessary as the caller 
    * (ServerManager.processMsgs) already owns the monitor for the RegionManager.
    * 
    * @param info

Modified: hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/master/ServerManager.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/master/ServerManager.java?rev=734482&r1=734481&r2=734482&view=diff
==============================================================================
--- hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/master/ServerManager.java (original)
+++ hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/master/ServerManager.java Wed Jan
14 10:56:39 2009
@@ -81,6 +81,11 @@
   // Last time we logged average load.
   private volatile long lastLogOfAverageLaod = 0;
   private final long loggingPeriodForAverageLoad;
+  
+  /* The regionserver will not be assigned or asked close regions if it
+   * is currently opening >= this many regions.
+   */
+  private final int nobalancingCount;
 
   /**
    * @param master
@@ -92,6 +97,8 @@
         15 * 1000));
     this.loggingPeriodForAverageLoad = master.getConfiguration().
       getLong("hbase.master.avgload.logging.period", 60000);
+    this.nobalancingCount = master.getConfiguration().
+      getInt("hbase.regions.nobalancing.count", 4);
   }
  
   /*
@@ -330,7 +337,14 @@
     }    
   }
 
-  /** RegionServer is checking in, no exceptional circumstances */
+  /* RegionServer is checking in, no exceptional circumstances
+   * @param serverName
+   * @param serverInfo
+   * @param mostLoadedRegions
+   * @param msgs
+   * @return
+   * @throws IOException
+   */
   private HMsg[] processRegionServerAllsWell(String serverName, 
     HServerInfo serverInfo, HRegionInfo[] mostLoadedRegions, HMsg[] msgs)
   throws IOException {
@@ -350,7 +364,6 @@
         // and the load on this server has changed
         synchronized (loadToServers) {
           Set<String> servers = loadToServers.get(load);
-
           // Note that servers should never be null because loadToServers
           // and serversToLoad are manipulated in pairs
           servers.remove(serverName);
@@ -370,6 +383,7 @@
       servers.add(serverName);
       loadToServers.put(load, servers);
     }
+
     // Next, process messages for this server
     return processMsgs(serverName, serverInfo, mostLoadedRegions, msgs);
   }
@@ -389,11 +403,13 @@
         "hbase-958 debugging");
     }
     // Get reports on what the RegionServer did.
+    int openingCount = 0;
     for (int i = 0; i < incomingMsgs.length; i++) {
       HRegionInfo region = incomingMsgs[i].getRegionInfo();
       LOG.info("Received " + incomingMsgs[i] + " from " + serverName);
       switch (incomingMsgs[i].getType()) {
         case MSG_REPORT_PROCESS_OPEN:
+          openingCount++;
           break;
         
         case MSG_REPORT_OPEN:
@@ -425,11 +441,15 @@
       }
 
       // Figure out what the RegionServer ought to do, and write back.
-      master.regionManager.assignRegions(serverInfo, serverName, 
+      
+      // Should we tell it close regions because its overloaded?  If its
+      // currently opening regions, leave it alone till all are open.
+      if (openingCount < this.nobalancingCount) {
+        this.master.regionManager.assignRegions(serverInfo, serverName, 
           mostLoadedRegions, returnMsgs);
-
+      }
       // Send any pending table actions.
-      master.regionManager.applyActions(serverInfo, returnMsgs);
+      this.master.regionManager.applyActions(serverInfo, returnMsgs);
     }
     return returnMsgs.toArray(new HMsg[returnMsgs.size()]);
   }



Mime
View raw message