diff --git hbase-server/src/main/java/org/apache/hadoop/hbase/mapreduce/LoadIncrementalHFiles.java hbase-server/src/main/java/org/apache/hadoop/hbase/mapreduce/LoadIncrementalHFiles.java index 0bed818..a5e7097 100644 --- hbase-server/src/main/java/org/apache/hadoop/hbase/mapreduce/LoadIncrementalHFiles.java +++ hbase-server/src/main/java/org/apache/hadoop/hbase/mapreduce/LoadIncrementalHFiles.java @@ -51,6 +51,7 @@ import org.apache.hadoop.hbase.client.ConnectionFactory; import org.apache.hadoop.hbase.client.HBaseAdmin; import org.apache.hadoop.hbase.client.HConnection; import org.apache.hadoop.hbase.client.HTable; +import org.apache.hadoop.hbase.client.NeedUnmanagedConnectionException; import org.apache.hadoop.hbase.client.RegionLocator; import org.apache.hadoop.hbase.client.RegionServerCallable; import org.apache.hadoop.hbase.client.RpcRetryingCallerFactory; @@ -177,6 +178,7 @@ public class LoadIncrementalHFiles extends Configured implements Tool { this.hfilePath = hfilePath; } + @Override public String toString() { return "family:"+ Bytes.toString(family) + " path:" + hfilePath.toString(); } @@ -245,7 +247,17 @@ public class LoadIncrementalHFiles extends Configured implements Tool { public void doBulkLoad(Path hfofDir, final HTable table) throws TableNotFoundException, IOException { - doBulkLoad(hfofDir, table.getConnection().getAdmin(), table, table.getRegionLocator()); + Admin admin = null; + try { + try { + admin = table.getConnection().getAdmin(); + } catch (NeedUnmanagedConnectionException ex) { + admin = new HBaseAdmin(table.getConfiguration()); + } + doBulkLoad(hfofDir, admin, table, table.getRegionLocator()); + } finally { + admin.close(); + } } /** @@ -398,6 +410,7 @@ public class LoadIncrementalHFiles extends Configured implements Tool { final Collection lqis = e.getValue(); final Callable> call = new Callable>() { + @Override public List call() throws Exception { List toRetry = tryAtomicRegionLoad(conn, table.getName(), first, lqis); @@ -474,6 +487,7 @@ public class LoadIncrementalHFiles extends Configured implements Tool { final LoadQueueItem item = queue.remove(); final Callable> call = new Callable>() { + @Override public List call() throws Exception { List splits = groupOrSplit(regionGroups, item, table, startEndKeys); return splits;