commit e515c7975e092c54edbbb0b2bb75fcb67cc488c2 Author: Todd Lipcon Date: Fri Mar 4 12:39:33 2011 -0800 HBASE-3639. FSUtils.getRootDir should qualify path Author: Todd Lipcon Reason: fix stackoverflow error diff --git src/main/java/org/apache/hadoop/hbase/master/MasterFileSystem.java src/main/java/org/apache/hadoop/hbase/master/MasterFileSystem.java index 79ac17b..af99d9f 100644 --- src/main/java/org/apache/hadoop/hbase/master/MasterFileSystem.java +++ src/main/java/org/apache/hadoop/hbase/master/MasterFileSystem.java @@ -81,10 +81,11 @@ public class MasterFileSystem { this.rootdir = FSUtils.getRootDir(conf); // Cover both bases, the old way of setting default fs and the new. // We're supposed to run on 0.20 and 0.21 anyways. - conf.set("fs.default.name", this.rootdir.toString()); - conf.set("fs.defaultFS", this.rootdir.toString()); + this.fs = this.rootdir.getFileSystem(conf); + String fsUri = this.fs.getUri().toString(); + conf.set("fs.default.name", fsUri); + conf.set("fs.defaultFS", fsUri); // setup the filesystem variable - this.fs = FileSystem.get(conf); // set up the archived logs path this.oldLogDir = new Path(this.rootdir, HConstants.HREGION_OLDLOGDIR_NAME); createInitialFileSystemLayout(); diff --git src/main/java/org/apache/hadoop/hbase/util/FSUtils.java src/main/java/org/apache/hadoop/hbase/util/FSUtils.java index 48cbaad..9b02048 100644 --- src/main/java/org/apache/hadoop/hbase/util/FSUtils.java +++ src/main/java/org/apache/hadoop/hbase/util/FSUtils.java @@ -304,11 +304,13 @@ public class FSUtils { /** * @param c configuration * @return Path to hbase root directory: i.e. hbase.rootdir from - * configuration as a Path. + * configuration as a qualified Path. * @throws IOException e */ public static Path getRootDir(final Configuration c) throws IOException { - return new Path(c.get(HConstants.HBASE_DIR)); + Path p = new Path(c.get(HConstants.HBASE_DIR)); + FileSystem fs = p.getFileSystem(c); + return p.makeQualified(fs); } /**