HBASE-15606 Limit creating zk connection in HBaseAdmin#getCompactionState() only to case when 'hbase:meta' is checked.
Signed-off-by: stack <stack@apache.org>
This commit is contained in:
parent
ac8cd373eb
commit
d393603dea
|
@ -3017,12 +3017,12 @@ public class HBaseAdmin implements Admin {
|
|||
break;
|
||||
case NORMAL:
|
||||
default:
|
||||
ZooKeeperWatcher zookeeper =
|
||||
new ZooKeeperWatcher(conf, ZK_IDENTIFIER_PREFIX + connection.toString(),
|
||||
new ThrowableAbortable());
|
||||
ZooKeeperWatcher zookeeper = null;
|
||||
try {
|
||||
List<Pair<HRegionInfo, ServerName>> pairs;
|
||||
if (TableName.META_TABLE_NAME.equals(tableName)) {
|
||||
zookeeper = new ZooKeeperWatcher(conf, ZK_IDENTIFIER_PREFIX + connection.toString(),
|
||||
new ThrowableAbortable());
|
||||
pairs = new MetaTableLocator().getMetaRegionsAndLocations(zookeeper);
|
||||
} else {
|
||||
pairs = MetaTableAccessor.getTableRegionsAndLocations(connection, tableName);
|
||||
|
@ -3074,8 +3074,10 @@ public class HBaseAdmin implements Admin {
|
|||
} catch (ServiceException se) {
|
||||
throw ProtobufUtil.getRemoteException(se);
|
||||
} finally {
|
||||
if (zookeeper != null) {
|
||||
zookeeper.close();
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
return state;
|
||||
|
|
Loading…
Reference in New Issue