diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java index 099a3a3cdb2..fba2e4eb0ce 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java @@ -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 -ROOT- and .META. 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