Author: tedyu
Date: Mon Feb 13 18:45:01 2012
New Revision: 1243648
URL: http://svn.apache.org/viewvc?rev=1243648&view=rev
Log:
HBASE-5327 Print a message when an invalid hbase.rootdir is passed (Jimmy
Xiang)
Modified:
hbase/branches/0.92/CHANGES.txt
hbase/branches/0.92/src/main/java/org/apache/hadoop/hbase/master/MasterFileSystem.java
Modified: hbase/branches/0.92/CHANGES.txt
URL:
http://svn.apache.org/viewvc/hbase/branches/0.92/CHANGES.txt?rev=1243648&r1=1243647&r2=1243648&view=diff
==============================================================================
--- hbase/branches/0.92/CHANGES.txt (original)
+++ hbase/branches/0.92/CHANGES.txt Mon Feb 13 18:45:01 2012
@@ -962,6 +962,7 @@ Release 0.90.6 - Unreleased
HBASE-5060 HBase client is blocked forever (Jinchao)
HBASE-5009 Failure of creating split dir if it already exists prevents
splits from happening further
HBASE-5041 Major compaction on non existing table does not throw error
(Shrijeet)
+ HBASE-5327 Print a message when an invalid hbase.rootdir is passed (Jimmy
Xiang)
Release 0.90.5 - Unreleased
Modified:
hbase/branches/0.92/src/main/java/org/apache/hadoop/hbase/master/MasterFileSystem.java
URL:
http://svn.apache.org/viewvc/hbase/branches/0.92/src/main/java/org/apache/hadoop/hbase/master/MasterFileSystem.java?rev=1243648&r1=1243647&r2=1243648&view=diff
==============================================================================
---
hbase/branches/0.92/src/main/java/org/apache/hadoop/hbase/master/MasterFileSystem.java
(original)
+++
hbase/branches/0.92/src/main/java/org/apache/hadoop/hbase/master/MasterFileSystem.java
Mon Feb 13 18:45:01 2012
@@ -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 {
* </ol>
* 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() {
@@ -323,21 +326,30 @@ public class MasterFileSystem {
FSUtils.waitOnSafeMode(c, c.getInt(HConstants.THREAD_WAKE_FREQUENCY,
10 * 1000));
// Filesystem is good. Go ahead and check for hbase.rootdir.
- if (!fs.exists(rd)) {
- fs.mkdirs(rd);
- // DFS leaves safe mode with 0 DNs when there are 0 blocks.
- // We used to handle this by checking the current DN count and waiting
until
- // it is nonzero. With security, the check for datanode count doesn't
work --
- // it is a privileged op. So instead we adopt the strategy of the
jobtracker
- // and simply retry file creation during bootstrap indefinitely. As soon
as
- // there is one datanode it will succeed. Permission problems should have
- // already been caught by mkdirs above.
- FSUtils.setVersion(fs, rd, c.getInt(HConstants.THREAD_WAKE_FREQUENCY,
- 10 * 1000));
- } else {
- // as above
- FSUtils.checkVersion(fs, rd, true,
c.getInt(HConstants.THREAD_WAKE_FREQUENCY,
- 10 * 1000));
+ try {
+ if (!fs.exists(rd)) {
+ fs.mkdirs(rd);
+ // DFS leaves safe mode with 0 DNs when there are 0 blocks.
+ // We used to handle this by checking the current DN count and waiting
until
+ // it is nonzero. With security, the check for datanode count doesn't
work --
+ // it is a privileged op. So instead we adopt the strategy of the
jobtracker
+ // and simply retry file creation during bootstrap indefinitely. As
soon as
+ // there is one datanode it will succeed. Permission problems should
have
+ // already been caught by mkdirs above.
+ 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));
+ }
+ } catch (IllegalArgumentException iae) {
+ LOG.fatal("Please fix invalid configuration for "
+ + HConstants.HBASE_DIR + " " + rd.toString(), iae);
+ throw iae;
}
// Make sure cluster ID exists
if (!FSUtils.checkClusterIdExists(fs, rd, c.getInt(