HBASE-590 HBase migration tool does not get correct FileSystem or root directory if configuration is not correct.

Commit change to trunk.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@649668 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jim Kellerman 2008-04-18 19:47:21 +00:00
parent 5af9719de3
commit 628124f7ed
1 changed files with 16 additions and 2 deletions

View File

@ -124,6 +124,20 @@ public class Migrate extends Configured implements Tool {
return -1;
}
// Validate root directory path
Path rd = new Path(conf.get(HConstants.HBASE_DIR));
try {
// Validate root directory path
FSUtils.validateRootPath(rd);
} catch (IOException e) {
LOG.fatal("Not starting migration because the root directory path '" +
rd.toString() + "' is not valid. Check the setting of the" +
" configuration parameter '" + HConstants.HBASE_DIR + "'", e);
return -1;
}
this.conf.set("fs.default.name", rd.toString());
try {
// Verify file system is up.
fs = FileSystem.get(conf); // get DFS handle
@ -315,13 +329,13 @@ public class Migrate extends Configured implements Tool {
LOG.info(message + " ignoring");
} else if (action == ACTION.DELETE) {
LOG.info(message + " deleting");
fs.delete(p);
fs.delete(p, true);
} else {
// ACTION.PROMPT
String response = prompt(message + " delete? [y/n]");
if (response.startsWith("Y") || response.startsWith("y")) {
LOG.info(message + " deleting");
fs.delete(p);
fs.delete(p, true);
}
}
}