You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by mb...@apache.org on 2014/08/21 20:15:05 UTC

[4/6] git commit: HBASE-11789 LoadIncrementalHFiles is not picking up the -D option

HBASE-11789 LoadIncrementalHFiles is not picking up the -D option


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/600bee44
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/600bee44
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/600bee44

Branch: refs/heads/branch-1
Commit: 600bee44be654c831c2973cc95b62127799b5468
Parents: 07f9f3d
Author: Matteo Bertozzi <ma...@cloudera.com>
Authored: Thu Aug 21 19:05:17 2014 +0100
Committer: Matteo Bertozzi <ma...@cloudera.com>
Committed: Thu Aug 21 19:09:29 2014 +0100

----------------------------------------------------------------------
 .../hbase/mapreduce/LoadIncrementalHFiles.java  | 31 +++++++++++++-------
 1 file changed, 21 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/600bee44/hbase-server/src/main/java/org/apache/hadoop/hbase/mapreduce/LoadIncrementalHFiles.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/mapreduce/LoadIncrementalHFiles.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/mapreduce/LoadIncrementalHFiles.java
index a1f79b4..3e61d95 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/mapreduce/LoadIncrementalHFiles.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/mapreduce/LoadIncrementalHFiles.java
@@ -123,17 +123,26 @@ public class LoadIncrementalHFiles extends Configured implements Tool {
   private String bulkToken;
   private UserProvider userProvider;
 
+  private LoadIncrementalHFiles() {}
+
   public LoadIncrementalHFiles(Configuration conf) throws Exception {
     super(conf);
-    // make a copy, just to be sure we're not overriding someone else's config
-    setConf(HBaseConfiguration.create(getConf()));
-    // disable blockcache for tool invocation, see HBASE-10500
-    getConf().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);
+    initialize();
+  }
+
+  private void initialize() throws Exception {
+    if (hbAdmin == null) {
+      // make a copy, just to be sure we're not overriding someone else's config
+      setConf(HBaseConfiguration.create(getConf()));
+      Configuration conf = getConf();
+      // 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() {
@@ -888,6 +897,8 @@ public class LoadIncrementalHFiles extends Configured implements Tool {
       return -1;
     }
 
+    initialize();
+
     String dirPath = args[0];
     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 {
     Configuration conf = HBaseConfiguration.create();
-    int ret = ToolRunner.run(new LoadIncrementalHFiles(conf), args);
+    int ret = ToolRunner.run(conf, new LoadIncrementalHFiles(), args);
     System.exit(ret);
   }