diff --git hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java index b56b6ed..6022fbb 100644 --- hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java +++ hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java @@ -810,11 +810,16 @@ MasterServices, Server { // assigned when master is shutting down if(this.stopped) return; - if (this.distributedLogReplay && oldMetaServerLocation != null - && previouslyFailedServers.contains(oldMetaServerLocation)) { + String metaRecoveringZNode = ZKUtil.joinZNode(zooKeeper.recoveringRegionsZNode, + HRegionInfo.FIRST_META_REGIONINFO.getEncodedName()); + if (this.distributedLogReplay && (ZKUtil.checkExists(zooKeeper, metaRecoveringZNode) != -1)) { // replay WAL edits mode need new .META. RS is assigned firstly status.setStatus("replaying log for Meta Region"); - this.fileSystemManager.splitMetaLog(oldMetaServerLocation); + // need to use previouslyFailedServers instead of oldMetaServerLocation to address the chained + // failure situation(recovery failed multiple times in a row). Passing more servers into + // splitMetaLog is all right. If a server doesn't have .META. wal, there is no op for the + // server. + this.fileSystemManager.splitMetaLog(previouslyFailedServers); } enableServerShutdownHandler(); diff --git hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterFileSystem.java hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterFileSystem.java index cee6d3c..4771580 100644 --- hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterFileSystem.java +++ hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterFileSystem.java @@ -294,9 +294,18 @@ public class MasterFileSystem { * @throws IOException */ public void splitMetaLog(final ServerName serverName) throws IOException { - long splitTime = 0, splitLogSize = 0; Set serverNames = new HashSet(); serverNames.add(serverName); + splitMetaLog(serverNames); + } + + /** + * Specialized method to handle the splitting for meta HLog + * @param serverNames + * @throws IOException + */ + public void splitMetaLog(final Set serverNames) throws IOException { + long splitTime = 0, splitLogSize = 0; List logDirs = getLogDirs(serverNames); splitLogManager.handleDeadWorkers(serverNames);