hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject svn commit: r655962 - in /hadoop/hbase/trunk: CHANGES.txt src/java/org/apache/hadoop/hbase/master/HMaster.java src/java/org/apache/hadoop/hbase/master/ServerManager.java src/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
Date Tue, 13 May 2008 18:25:31 GMT
Author: jimk
Date: Tue May 13 11:25:31 2008
New Revision: 655962

URL: http://svn.apache.org/viewvc?rev=655962&view=rev
Log:
HBASE-624   Master will shut down if number of active region servers is zero even if shutdown
was not requested

M HMaster

- Moved HMaster.quiescedMetaServers to ServerManager.quiescedServers and changed name since
only servers serving user regions get quiesced.
- Removed HMaster.tableInCreation - not used

M ServerManager

- Don't check if quiescedServers.get() >= serversToServerInfo.size() unless master.shutdownRequested
is true.

M HRegionServer

- Change order of checks in main loop of HRegionServer.run, so that booleans are checked before
we check the number of messages to process
- Don't break out of main loop if restart or stop requested - stop is checked at top of loop
and we need to continue rather than break out of main loop if restart was requested


Modified:
    hadoop/hbase/trunk/CHANGES.txt
    hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/master/HMaster.java
    hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/master/ServerManager.java
    hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java

Modified: hadoop/hbase/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/CHANGES.txt?rev=655962&r1=655961&r2=655962&view=diff
==============================================================================
--- hadoop/hbase/trunk/CHANGES.txt (original)
+++ hadoop/hbase/trunk/CHANGES.txt Tue May 13 11:25:31 2008
@@ -37,6 +37,8 @@
    HBASE-453   undeclared throwable exception from HTable.get
    HBASE-620   testmergetool failing in branch and trunk since hbase-618 went in
    HBASE-622   Remove StaticTestEnvironment and put a log4j.properties in src/test
+   HBASE-624   Master will shut down if number of active region servers is zero
+               even if shutdown was not requested
 
   IMPROVEMENTS
    HBASE-559   MR example job to count table rows

Modified: hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/master/HMaster.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/master/HMaster.java?rev=655962&r1=655961&r2=655962&view=diff
==============================================================================
--- hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/master/HMaster.java (original)
+++ hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/master/HMaster.java Tue May 13 11:25:31
2008
@@ -21,18 +21,14 @@
 
 import java.io.IOException;
 import java.lang.reflect.Constructor;
-import java.util.Collections;
-import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Random;
-import java.util.Set;
 import java.util.concurrent.BlockingQueue;
 import java.util.concurrent.DelayQueue;
 import java.util.concurrent.LinkedBlockingQueue;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.concurrent.atomic.AtomicInteger;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -104,7 +100,6 @@
   // hosting class
   volatile AtomicBoolean closed = new AtomicBoolean(true);
   volatile boolean shutdownRequested = false;
-  volatile AtomicInteger quiescedMetaServers = new AtomicInteger(0);
   volatile boolean fsOk = true;
   final Path rootdir;
   final HBaseConfiguration conf;
@@ -142,10 +137,6 @@
     return infoServer;
   }
 
-  /** Set of tables currently in creation. */
-  private volatile Set<Text> tableInCreation = 
-    Collections.synchronizedSet(new HashSet<Text>());
-
   ServerManager serverManager;
   RegionManager regionManager;
   

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=655962&r1=655961&r2=655962&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 Tue May
13 11:25:31 2008
@@ -28,6 +28,7 @@
 import java.util.HashSet;
 import java.util.ArrayList;
 import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.atomic.AtomicInteger;
 import java.util.Collections;
 
 import org.apache.commons.logging.Log;
@@ -50,6 +51,8 @@
 class ServerManager implements HConstants {
   static final Log LOG = LogFactory.getLog(ServerManager.class.getName());
   
+  private final AtomicInteger quiescedServers = new AtomicInteger(0);
+
   /** The map of known server names to server info */
   final Map<String, HServerInfo> serversToServerInfo =
     new ConcurrentHashMap<String, HServerInfo>();
@@ -161,25 +164,27 @@
         return new HMsg[0];
       } else if (msgs[0].getMsg() == HMsg.MSG_REPORT_QUIESCED) {
         LOG.info("Region server " + serverName + " quiesced");
-        master.quiescedMetaServers.incrementAndGet();
+        quiescedServers.incrementAndGet();
       }
     }
 
-    if(master.quiescedMetaServers.get() >= serversToServerInfo.size()) {
-      // If the only servers we know about are meta servers, then we can
-      // proceed with shutdown
-      LOG.info("All user tables quiesced. Proceeding with shutdown");
-      master.startShutdown();
-    }
+    if (master.shutdownRequested) {
+      if(quiescedServers.get() >= serversToServerInfo.size()) {
+        // If the only servers we know about are meta servers, then we can
+        // proceed with shutdown
+        LOG.info("All user tables quiesced. Proceeding with shutdown");
+        master.startShutdown();
+      }
 
-    if (master.shutdownRequested && !master.closed.get()) {
-      if (msgs.length > 0 && msgs[0].getMsg() == HMsg.MSG_REPORT_QUIESCED) {
-        // Server is already quiesced, but we aren't ready to shut down
-        // return empty response
-        return new HMsg[0];
+      if (!master.closed.get()) {
+        if (msgs.length > 0 && msgs[0].getMsg() == HMsg.MSG_REPORT_QUIESCED) {
+          // Server is already quiesced, but we aren't ready to shut down
+          // return empty response
+          return new HMsg[0];
+        }
+        // Tell the server to stop serving any user regions
+        return new HMsg[]{new HMsg(HMsg.MSG_REGIONSERVER_QUIESCE)};
       }
-      // Tell the server to stop serving any user regions
-      return new HMsg[]{new HMsg(HMsg.MSG_REGIONSERVER_QUIESCE)};
     }
 
     if (master.closed.get()) {

Modified: hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java?rev=655962&r1=655961&r2=655962&view=diff
==============================================================================
--- hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java (original)
+++ hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java Tue
May 13 11:25:31 2008
@@ -306,8 +306,10 @@
 
             // Queue up the HMaster's instruction stream for processing
             boolean restart = false;
-            for(int i = 0; i < msgs.length && !stopRequested.get() &&
-                !restart; i++) {
+            for(int i = 0;
+                !restart && !stopRequested.get() && i < msgs.length;
+                i++) {
+              
               switch(msgs[i].getMsg()) {
 
               case HMsg.MSG_CALL_SERVER_STARTUP:
@@ -370,12 +372,13 @@
                 }
               }
             }
+            // Reset tries count if we had a successful transaction.
+            tries = 0;
+
             if (restart || this.stopRequested.get()) {
               toDo.clear();
-              break;
+              continue;
             }
-            // Reset tries count if we had a successful transaction.
-            tries = 0;
           } catch (Exception e) {
             if (e instanceof IOException) {
               e = RemoteExceptionHandler.checkIOException((IOException) e);



Mime
View raw message