HBASE-19245 MultiTableInputFormatBase#getSplits creates a Connection per Table
We make one Connection only instead of a Connection per table (Change is just moving one line it involves right-shifting body of the function)
This commit is contained in:
parent
7139113fde
commit
3ad300a2b0
|
@ -178,13 +178,13 @@ public abstract class MultiTableInputFormatBase extends
|
|||
|
||||
List<InputSplit> splits = new ArrayList<>();
|
||||
Iterator iter = tableMaps.entrySet().iterator();
|
||||
// Make a single Connection to the Cluster and use it across all tables.
|
||||
try (Connection conn = ConnectionFactory.createConnection(context.getConfiguration())) {
|
||||
while (iter.hasNext()) {
|
||||
Map.Entry<TableName, List<Scan>> entry = (Map.Entry<TableName, List<Scan>>) iter.next();
|
||||
TableName tableName = entry.getKey();
|
||||
List<Scan> scanList = entry.getValue();
|
||||
|
||||
try (Connection conn = ConnectionFactory.createConnection(context.getConfiguration());
|
||||
Table table = conn.getTable(tableName);
|
||||
try (Table table = conn.getTable(tableName);
|
||||
RegionLocator regionLocator = conn.getRegionLocator(tableName)) {
|
||||
RegionSizeCalculator sizeCalculator = new RegionSizeCalculator(
|
||||
regionLocator, conn.getAdmin());
|
||||
|
@ -230,13 +230,15 @@ public abstract class MultiTableInputFormatBase extends
|
|||
|
||||
splits.add(split);
|
||||
|
||||
if (LOG.isDebugEnabled())
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("getSplits: split -> " + (count++) + " -> " + split);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return splits;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue