diff --git src/main/java/org/apache/hadoop/hbase/master/MasterFileSystem.java src/main/java/org/apache/hadoop/hbase/master/MasterFileSystem.java index aff8895..0a1bb4e 100644 --- src/main/java/org/apache/hadoop/hbase/master/MasterFileSystem.java +++ src/main/java/org/apache/hadoop/hbase/master/MasterFileSystem.java @@ -109,8 +109,7 @@ public class MasterFileSystem { } // setup the filesystem variable // set up the archived logs path - this.oldLogDir = new Path(this.rootdir, HConstants.HREGION_OLDLOGDIR_NAME); - createInitialFileSystemLayout(); + this.oldLogDir = createInitialFileSystemLayout(); } /** @@ -123,14 +122,18 @@ public class MasterFileSystem { * * Idempotent. */ - private void createInitialFileSystemLayout() throws IOException { + private Path createInitialFileSystemLayout() throws IOException { // check if the root directory exists checkRootDir(this.rootdir, conf, this.fs); + Path oldLogDir = new Path(this.rootdir, HConstants.HREGION_OLDLOGDIR_NAME); + // Make sure the region servers can archive their old logs - if(!this.fs.exists(this.oldLogDir)) { - this.fs.mkdirs(this.oldLogDir); + if(!this.fs.exists(oldLogDir)) { + this.fs.mkdirs(oldLogDir); } + + return oldLogDir; } public FileSystem getFileSystem() { @@ -333,6 +336,9 @@ public class MasterFileSystem { FSUtils.setVersion(fs, rd, c.getInt(HConstants.THREAD_WAKE_FREQUENCY, 10 * 1000)); } else { + if (!fs.isDirectory(rd)) { + throw new IllegalArgumentException(rd.toString() + " is not a directory"); + } // as above FSUtils.checkVersion(fs, rd, true, c.getInt(HConstants.THREAD_WAKE_FREQUENCY, 10 * 1000));