hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From st...@apache.org
Subject svn commit: r1475986 - in /hbase/trunk/hbase-server/src: main/java/org/apache/hadoop/hbase/master/HMaster.java test/java/org/apache/hadoop/hbase/master/TestMasterShutdown.java
Date Thu, 25 Apr 2013 22:13:26 GMT
Author: stack
Date: Thu Apr 25 22:13:26 2013
New Revision: 1475986

URL: http://svn.apache.org/r1475986
Log:
HBASE-8422 Master won't go down. Stuck waiting on .META. to come on line

Modified:
    hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java
    hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMasterShutdown.java

Modified: hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java?rev=1475986&r1=1475985&r2=1475986&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java (original)
+++ hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java Thu
Apr 25 22:13:26 2013
@@ -2160,6 +2160,11 @@ Server {
         this.activeMasterManager.clusterHasActiveMaster.notifyAll();
       }
     }
+    // If no region server is online then master may stuck waiting on .META. to come on line.
+    // See HBASE-8422.
+    if (this.catalogTracker != null && this.serverManager.getOnlineServers().isEmpty())
{
+      this.catalogTracker.stop();
+    }
   }
 
   @Override

Modified: hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMasterShutdown.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMasterShutdown.java?rev=1475986&r1=1475985&r2=1475986&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMasterShutdown.java
(original)
+++ hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMasterShutdown.java
Thu Apr 25 22:13:26 2013
@@ -92,5 +92,46 @@ public class TestMasterShutdown {
     TEST_UTIL.shutdownMiniCluster();
   }
 
+  @Test(timeout = 180000)
+  public void testMasterShutdownBeforeStartingAnyRegionServer() throws Exception {
+
+    final int NUM_MASTERS = 1;
+    final int NUM_RS = 0;
+
+    // Create config to use for this cluster
+    Configuration conf = HBaseConfiguration.create();
+
+    // Start the cluster
+    final HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility(conf);
+    TEST_UTIL.startMiniDFSCluster(3);
+    TEST_UTIL.startMiniZKCluster();
+    TEST_UTIL.createRootDir();
+    final LocalHBaseCluster cluster =
+        new LocalHBaseCluster(conf, NUM_MASTERS, NUM_RS, HMaster.class,
+            MiniHBaseCluster.MiniHBaseClusterRegionServer.class);
+    final MasterThread master = cluster.getMasters().get(0);
+    master.start();
+    Thread shutdownThread = new Thread() {
+      public void run() {
+        try {
+          TEST_UTIL.getHBaseAdmin().shutdown();
+          cluster.waitOnMaster(0);
+        } catch (Exception e) {
+        }
+      };
+    };
+    shutdownThread.start();
+    master.join();
+    shutdownThread.join();
+
+    List<MasterThread> masterThreads = cluster.getMasters();
+    // make sure all the masters properly shutdown
+    assertEquals(0, masterThreads.size());
+
+    TEST_UTIL.shutdownMiniZKCluster();
+    TEST_UTIL.shutdownMiniDFSCluster();
+    TEST_UTIL.cleanupTestDir();
+  }
+
 }
 



Mime
View raw message