LoadIncrementalHFiles is not picking up the -D option

This commit is contained in:
Matteo Bertozzi 2014-08-20 21:31:29 +01:00
parent ea32555b9a
commit e05e27f2d5
1 changed files with 21 additions and 10 deletions

View File

@ -123,17 +123,26 @@ public class LoadIncrementalHFiles extends Configured implements Tool {
private String bulkToken; private String bulkToken;
private UserProvider userProvider; private UserProvider userProvider;
private LoadIncrementalHFiles() {}
public LoadIncrementalHFiles(Configuration conf) throws Exception { public LoadIncrementalHFiles(Configuration conf) throws Exception {
super(conf); super(conf);
// make a copy, just to be sure we're not overriding someone else's config initialize();
setConf(HBaseConfiguration.create(getConf())); }
// disable blockcache for tool invocation, see HBASE-10500
getConf().setFloat(HConstants.HFILE_BLOCK_CACHE_SIZE_KEY, 0); private void initialize() throws Exception {
this.hbAdmin = new HBaseAdmin(conf); if (hbAdmin == null) {
this.userProvider = UserProvider.instantiate(conf); // make a copy, just to be sure we're not overriding someone else's config
this.fsDelegationToken = new FsDelegationToken(userProvider, "renewer"); setConf(HBaseConfiguration.create(getConf()));
assignSeqIds = conf.getBoolean(ASSIGN_SEQ_IDS, true); Configuration conf = getConf();
maxFilesPerRegionPerFamily = conf.getInt(MAX_FILES_PER_REGION_PER_FAMILY, 32); // disable blockcache for tool invocation, see HBASE-10500
conf.setFloat(HConstants.HFILE_BLOCK_CACHE_SIZE_KEY, 0);
this.hbAdmin = new HBaseAdmin(conf);
this.userProvider = UserProvider.instantiate(conf);
this.fsDelegationToken = new FsDelegationToken(userProvider, "renewer");
assignSeqIds = conf.getBoolean(ASSIGN_SEQ_IDS, true);
maxFilesPerRegionPerFamily = conf.getInt(MAX_FILES_PER_REGION_PER_FAMILY, 32);
}
} }
private void usage() { private void usage() {
@ -888,6 +897,8 @@ public class LoadIncrementalHFiles extends Configured implements Tool {
return -1; return -1;
} }
initialize();
String dirPath = args[0]; String dirPath = args[0];
TableName tableName = TableName.valueOf(args[1]); TableName tableName = TableName.valueOf(args[1]);
@ -903,7 +914,7 @@ public class LoadIncrementalHFiles extends Configured implements Tool {
public static void main(String[] args) throws Exception { public static void main(String[] args) throws Exception {
Configuration conf = HBaseConfiguration.create(); Configuration conf = HBaseConfiguration.create();
int ret = ToolRunner.run(new LoadIncrementalHFiles(conf), args); int ret = ToolRunner.run(conf, new LoadIncrementalHFiles(), args);
System.exit(ret); System.exit(ret);
} }