HBASE-21524 Fix logging in ConnectionImplementation.isTableAvailable()

Signed-off-by: Michael Stack <stack@apache.org>
This commit is contained in:
Josh Elser 2018-11-28 22:03:55 -05:00
parent 001aabd40a
commit acb58284a5
1 changed files with 8 additions and 12 deletions

View File

@ -611,7 +611,7 @@ class ConnectionImplementation implements ClusterConnection, Closeable {
checkClosed(); checkClosed();
try { try {
if (!isTableEnabled(tableName)) { if (!isTableEnabled(tableName)) {
LOG.debug("Table " + tableName + " not enabled"); LOG.debug("Table {} not enabled", tableName);
return false; return false;
} }
List<Pair<RegionInfo, ServerName>> locations = List<Pair<RegionInfo, ServerName>> locations =
@ -622,10 +622,8 @@ class ConnectionImplementation implements ClusterConnection, Closeable {
for (Pair<RegionInfo, ServerName> pair : locations) { for (Pair<RegionInfo, ServerName> pair : locations) {
RegionInfo info = pair.getFirst(); RegionInfo info = pair.getFirst();
if (pair.getSecond() == null) { if (pair.getSecond() == null) {
if (LOG.isDebugEnabled()) { LOG.debug("Table {} has not deployed region {}", tableName,
LOG.debug("Table " + tableName + " has not deployed region " + pair.getFirst() pair.getFirst().getEncodedName());
.getEncodedName());
}
notDeployed++; notDeployed++;
} else if (splitKeys != null } else if (splitKeys != null
&& !Bytes.equals(info.getStartKey(), HConstants.EMPTY_BYTE_ARRAY)) { && !Bytes.equals(info.getStartKey(), HConstants.EMPTY_BYTE_ARRAY)) {
@ -643,23 +641,21 @@ class ConnectionImplementation implements ClusterConnection, Closeable {
} }
if (notDeployed > 0) { if (notDeployed > 0) {
if (LOG.isDebugEnabled()) { if (LOG.isDebugEnabled()) {
LOG.debug("Table " + tableName + " has " + notDeployed + " regions"); LOG.debug("Table {} has {} regions not deployed", tableName, notDeployed);
} }
return false; return false;
} else if (splitKeys != null && regionCount != splitKeys.length + 1) { } else if (splitKeys != null && regionCount != splitKeys.length + 1) {
if (LOG.isDebugEnabled()) { if (LOG.isDebugEnabled()) {
LOG.debug("Table " + tableName + " expected to have " + (splitKeys.length + 1) LOG.debug("Table {} expected to have {} regions, but only {} available", tableName,
+ " regions, but only " + regionCount + " available"); splitKeys.length + 1, regionCount);
} }
return false; return false;
} else { } else {
if (LOG.isDebugEnabled()) { LOG.trace("Table {} should be available", tableName);
LOG.debug("Table " + tableName + " should be available");
}
return true; return true;
} }
} catch (TableNotFoundException tnfe) { } catch (TableNotFoundException tnfe) {
LOG.warn("Table " + tableName + " not enabled, it is not exists"); LOG.warn("Table {} does not exist", tableName);
return false; return false;
} }
} }