HBASE-5874 When 'fs.default.name' not configured, the hbck tool and Merge tool throws IllegalArgumentException (fulin wang)

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1345902 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jonathan Hsieh 2012-06-04 10:06:54 +00:00
parent b737e2e8bd
commit b975bdc489
2 changed files with 11 additions and 3 deletions

View File

@ -18,6 +18,7 @@
package org.apache.hadoop.hbase.util;
import java.io.IOException;
import java.net.URI;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
@ -2992,7 +2993,10 @@ public class HBaseFsck {
// create a fsck object
Configuration conf = HBaseConfiguration.create();
conf.set("fs.defaultFS", conf.get(HConstants.HBASE_DIR));
Path hbasedir = new Path(conf.get(HConstants.HBASE_DIR));
URI defaultFs = hbasedir.getFileSystem(conf).getUri();
conf.set("fs.defaultFS", defaultFs.toString()); // for hadoop 0.21+
conf.set("fs.default.name", defaultFs.toString()); // for hadoop 0.20
HBaseFsck fsck = new HBaseFsck(conf);
long sleepBeforeRerun = DEFAULT_SLEEP_BEFORE_RERUN;

View File

@ -384,8 +384,12 @@ public class Merge extends Configured implements Tool {
}
private void usage() {
System.err.println(
"Usage: bin/hbase merge <table-name> <region-1> <region-2>\n");
System.err
.println("For hadoop 0.20, Usage: bin/hbase org.apache.hadoop.hbase.util.Merge "
+ "[-Dfs.default.name=hdfs://nn:port] <table-name> <region-1> <region-2>\n");
System.err
.println("For hadoop 0.21+, Usage: bin/hbase org.apache.hadoop.hbase.util.Merge "
+ "[-Dfs.defaultFS=hdfs://nn:port] <table-name> <region-1> <region-2>\n");
}
public static void main(String[] args) {