HDFS-14371. Improve Logging in FSNamesystem by adding parameterized logging. Contributed by Shweta.

Signed-off-by: Wei-Chiu Chuang <weichiu@apache.org>
This commit is contained in:
Shweta 2019-04-05 16:08:05 -07:00 committed by Wei-Chiu Chuang
parent dc013f7a35
commit e9b859f749

View File

@ -2413,10 +2413,8 @@ CryptoProtocolVersion chooseProtocolVersion(
for (CryptoProtocolVersion c : supportedVersions) { for (CryptoProtocolVersion c : supportedVersions) {
if (c.equals(CryptoProtocolVersion.UNKNOWN)) { if (c.equals(CryptoProtocolVersion.UNKNOWN)) {
if (LOG.isDebugEnabled()) {
LOG.debug("Ignoring unknown CryptoProtocolVersion provided by " + LOG.debug("Ignoring unknown CryptoProtocolVersion provided by " +
"client: " + c.getUnknownValue()); "client: {}", c.getUnknownValue());
}
continue; continue;
} }
if (c.equals(required)) { if (c.equals(required)) {
@ -3693,9 +3691,7 @@ void commitBlockSynchronization(ExtendedBlock oldBlock,
if (deleteblock) { if (deleteblock) {
// This may be a retry attempt so ignore the failure // This may be a retry attempt so ignore the failure
// to locate the block. // to locate the block.
if (LOG.isDebugEnabled()) { LOG.debug("Block (={}) not found", oldBlock);
LOG.debug("Block (=" + oldBlock + ") not found");
}
return; return;
} else { } else {
throw new IOException("Block (=" + oldBlock + ") not found"); throw new IOException("Block (=" + oldBlock + ") not found");
@ -3729,9 +3725,8 @@ void commitBlockSynchronization(ExtendedBlock oldBlock,
if ((!iFile.isUnderConstruction() || storedBlock.isComplete()) && if ((!iFile.isUnderConstruction() || storedBlock.isComplete()) &&
iFile.getLastBlock().isComplete()) { iFile.getLastBlock().isComplete()) {
if (LOG.isDebugEnabled()) { if (LOG.isDebugEnabled()) {
LOG.debug("Unexpected block (=" + oldBlock LOG.debug("Unexpected block (={}) since the file (={}) is not "
+ ") since the file (=" + iFile.getLocalName() + "under construction", oldBlock, iFile.getLocalName());
+ ") is not under construction");
} }
return; return;
} }
@ -5636,9 +5631,7 @@ Collection<CorruptFileBlockInfo> listCorruptFileBlocks(String path,
} }
} }
cookieTab[0] = String.valueOf(skip); cookieTab[0] = String.valueOf(skip);
if (LOG.isDebugEnabled()) { LOG.debug("list corrupt file blocks returned: {}", count);
LOG.debug("list corrupt file blocks returned: " + count);
}
return corruptFiles; return corruptFiles;
} finally { } finally {
readUnlock("listCorruptFileBlocks"); readUnlock("listCorruptFileBlocks");
@ -6370,9 +6363,7 @@ private List<String> getCorruptFilesList() {
} }
} }
} catch (StandbyException e) { } catch (StandbyException e) {
if (LOG.isDebugEnabled()) { LOG.debug("Get corrupt file blocks returned error: {}", e.getMessage());
LOG.debug("Get corrupt file blocks returned error: " + e.getMessage());
}
} catch (IOException e) { } catch (IOException e) {
LOG.warn("Get corrupt file blocks returned error", e); LOG.warn("Get corrupt file blocks returned error", e);
} }