HBASE-5918 Master will block forever at startup if root server dies between assigning root and assigning meta (Chunhui)

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1352161 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Zhihong Yu 2012-06-20 15:33:40 +00:00
parent c85185a68f
commit 4cb2174c29
1 changed files with 14 additions and 2 deletions

View File

@ -635,8 +635,7 @@ Server {
// Make sure root and meta assigned before proceeding.
if (!assignRootAndMeta(status)) return;
serverShutdownHandlerEnabled = true;
this.serverManager.expireDeadNotExpiredServers();
enableServerShutdownHandler();
// Update meta with new HRI if required. i.e migrate all HRI with HTD to
// HRI with out HTD in meta and update the status in ROOT. This must happen
@ -719,6 +718,18 @@ Server {
return new ServerManager(master, services);
}
/**
* If ServerShutdownHandler is disabled, we enable it and expire those dead
* but not expired servers.
* @throws IOException
*/
private void enableServerShutdownHandler() throws IOException {
if (!serverShutdownHandlerEnabled) {
serverShutdownHandlerEnabled = true;
this.serverManager.expireDeadNotExpiredServers();
}
}
/**
* Check <code>-ROOT-</code> and <code>.META.</code> are assigned. If not,
* assign them.
@ -771,6 +782,7 @@ Server {
splitLogAndExpireIfOnline(currentMetaServer);
}
assignmentManager.assignMeta();
enableServerShutdownHandler();
this.catalogTracker.waitForMeta();
// Above check waits for general meta availability but this does not
// guarantee that the transition has completed