HBASE-8422 Master won't go down. Stuck waiting on .META. to come on line
git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1475986 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
7b8d3a6dc1
commit
c0046ba481
|
@ -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
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue