hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject svn commit: r751172 - in /hadoop/hbase/trunk: ./ src/java/org/apache/hadoop/hbase/master/
Date Sat, 07 Mar 2009 02:21:45 GMT
Author: jimk
Date: Sat Mar  7 02:21:44 2009
New Revision: 751172

URL: http://svn.apache.org/viewvc?rev=751172&view=rev
Log:
HBASE-1169  When a shutdown is requested, stop scanning META regions immediately

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/MetaScanner.java
    hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/master/RegionManager.java
    hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/master/RootScanner.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=751172&r1=751171&r2=751172&view=diff
==============================================================================
--- hadoop/hbase/trunk/CHANGES.txt (original)
+++ hadoop/hbase/trunk/CHANGES.txt Sat Mar  7 02:21:44 2009
@@ -39,6 +39,7 @@
                to compact when loaded with hundreds of regions
    HBASE-1247  checkAndSave doesn't Write Ahead Log
    HBASE-1243  oldlogfile.dat is screwed, so is it's region
+   HBASE-1169  When a shutdown is requested, stop scanning META regions immediately
 
   IMPROVEMENTS
    HBASE-1089  Add count of regions on filesystem to master UI; add percentage

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=751172&r1=751171&r2=751172&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 Sat Mar  7 02:21:44
2009
@@ -95,8 +95,8 @@
   
   static final Log LOG = LogFactory.getLog(HMaster.class.getName());
 
-  public long getProtocolVersion(String protocol,
-      long clientVersion) {
+  public long getProtocolVersion(@SuppressWarnings("unused") String protocol,
+      @SuppressWarnings("unused") long clientVersion) {
     return HBaseRPCProtocolVersion.versionID;
   }
 
@@ -105,7 +105,7 @@
   // started here in HMaster rather than have them have to know about the
   // hosting class
   volatile AtomicBoolean closed = new AtomicBoolean(true);
-  volatile boolean shutdownRequested = false;
+  volatile AtomicBoolean shutdownRequested = new AtomicBoolean(false);
   volatile boolean fsOk = true;
   final Path rootdir;
   private final HBaseConfiguration conf;
@@ -337,7 +337,7 @@
    */
   public HServerAddress getRootRegionLocation() {
     HServerAddress rootServer = null;
-    if (!shutdownRequested && !closed.get()) {
+    if (!shutdownRequested.get() && !closed.get()) {
       rootServer = regionManager.getRootRegionLocation();
     }
     return rootServer;
@@ -367,9 +367,14 @@
     try {
       while (!closed.get()) {
         // check if we should be shutting down
-        if (shutdownRequested && serverManager.numServers() == 0) {
-          startShutdown();
-          break;
+        if (shutdownRequested.get()) {
+          // The region servers won't all exit until we stop scanning the
+          // meta regions
+          regionManager.stopScanners();
+          if (serverManager.numServers() == 0) {
+            startShutdown();
+            break;
+          }
         }
         // work on the TodoQueue. If that fails, we should shut down.
         if (!processToDoQueue()) {
@@ -380,8 +385,6 @@
       LOG.fatal("Unhandled exception. Starting shutdown.", t);
       closed.set(true);
     }
-    // The region servers won't all exit until we stop scanning the meta regions
-    regionManager.stopScanners();
     
     // Wait for all the remaining region servers to report in.
     serverManager.letRegionServersShutdown();
@@ -593,7 +596,7 @@
 
   public void shutdown() {
     LOG.info("Cluster shutdown requested. Starting to quiesce servers");
-    this.shutdownRequested = true;
+    this.shutdownRequested.set(true);
   }
 
   public void createTable(HTableDescriptor desc)
@@ -958,7 +961,7 @@
   
   /**
    * Get the ZK wrapper object
-   * @return
+   * @return the zookeeper wrapper
    */
   public ZooKeeperWrapper getZooKeeperWrapper() {
     return zooKeeperWrapper;

Modified: hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/master/MetaScanner.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/master/MetaScanner.java?rev=751172&r1=751171&r2=751172&view=diff
==============================================================================
--- hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/master/MetaScanner.java (original)
+++ hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/master/MetaScanner.java Sat Mar  7
02:21:44 2009
@@ -51,7 +51,7 @@
    * @param master
    */
   public MetaScanner(HMaster master) {
-    super(master, false, master.metaRescanInterval, master.closed);
+    super(master, false, master.metaRescanInterval, master.shutdownRequested);
   }
 
   // Don't retry if we get an error while scanning. Errors are most often

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=751172&r1=751171&r2=751172&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 Sat Mar
 7 02:21:44 2009
@@ -132,7 +132,7 @@
   private final int zooKeeperNumRetries;
   private final int zooKeeperPause;
 
-  RegionManager(HMaster master) throws IOException {
+  RegionManager(HMaster master) {
     HBaseConfiguration conf = master.getConfiguration();
 
     this.master = master;
@@ -169,7 +169,7 @@
   
   void reassignRootRegion() {
     unsetRootRegion();
-    if (!master.shutdownRequested) {
+    if (!master.shutdownRequested.get()) {
       synchronized (regionsInTransition) {
         RegionState s = new RegionState(HRegionInfo.ROOT_REGIONINFO);
         s.setUnassigned();
@@ -1014,10 +1014,8 @@
   /**
    * Set the root region location.
    * @param address Address of the region server where the root lives
-   * @throws IOException If there's a problem connection to ZooKeeper.
    */
-  public void setRootRegionLocation(HServerAddress address)
-  throws IOException {
+  public void setRootRegionLocation(HServerAddress address) {
     writeRootRegionLocationToZooKeeper(address);
 
     synchronized (rootRegionLocation) {

Modified: hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/master/RootScanner.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/master/RootScanner.java?rev=751172&r1=751171&r2=751172&view=diff
==============================================================================
--- hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/master/RootScanner.java (original)
+++ hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/master/RootScanner.java Sat Mar  7
02:21:44 2009
@@ -31,7 +31,7 @@
    * @param master
    */
   public RootScanner(HMaster master) {
-    super(master, true, master.metaRescanInterval, master.closed);
+    super(master, true, master.metaRescanInterval, master.shutdownRequested);
   }
 
   /**

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=751172&r1=751171&r2=751172&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 Sat Mar
 7 02:21:44 2009
@@ -116,7 +116,6 @@
    * them or the server is shutting down.
    */
   private boolean checkForGhostReferences(final HServerInfo serverInfo) {
-    String s = serverInfo.getServerAddress().toString().trim();
     boolean result = false;
     for (long sleepTime = -1; !master.closed.get() && !result;) {
       if (sleepTime != -1) {
@@ -225,7 +224,7 @@
       }
     }
 
-    if (master.shutdownRequested) {
+    if (master.shutdownRequested.get()) {
       if(quiescedServers.get() >= serversToServerInfo.size()) {
         // If the only servers we know about are meta servers, then we can
         // proceed with shutdown



Mime
View raw message