HDFS-15425. Review Logging of DFSClient. Contributed by Hongbing Wang.

This commit is contained in:
He Xiaoqiao 2020-07-07 13:01:46 +08:00
parent 2bbd00dff4
commit 4f26454a7d
3 changed files with 9 additions and 18 deletions

View File

@ -332,12 +332,9 @@ public DFSClient(URI nameNodeUri, ClientProtocol rpcNamenode,
MIN_REPLICATION, MIN_REPLICATION,
HdfsClientConfigKeys.BlockWrite.ReplaceDatanodeOnFailure. HdfsClientConfigKeys.BlockWrite.ReplaceDatanodeOnFailure.
MIN_REPLICATION_DEFAULT); MIN_REPLICATION_DEFAULT);
if (LOG.isDebugEnabled()) { LOG.debug("Sets {} to {}",
LOG.debug( HdfsClientConfigKeys.BlockWrite.ReplaceDatanodeOnFailure.
"Sets " + HdfsClientConfigKeys.BlockWrite.ReplaceDatanodeOnFailure. MIN_REPLICATION, dtpReplaceDatanodeOnFailureReplication);
MIN_REPLICATION + " to "
+ dtpReplaceDatanodeOnFailureReplication);
}
this.ugi = UserGroupInformation.getCurrentUser(); this.ugi = UserGroupInformation.getCurrentUser();
this.namenodeUri = nameNodeUri; this.namenodeUri = nameNodeUri;

View File

@ -110,9 +110,7 @@ public class DFSStripedInputStream extends DFSInputStream {
dataBlkNum, parityBlkNum); dataBlkNum, parityBlkNum);
decoder = CodecUtil.createRawDecoder(dfsClient.getConfiguration(), decoder = CodecUtil.createRawDecoder(dfsClient.getConfiguration(),
ecPolicy.getCodecName(), coderOptions); ecPolicy.getCodecName(), coderOptions);
if (DFSClient.LOG.isDebugEnabled()) { DFSClient.LOG.debug("Creating an striped input stream for file {}", src);
DFSClient.LOG.debug("Creating an striped input stream for file " + src);
}
} }
private boolean useDirectBuffer() { private boolean useDirectBuffer() {
@ -465,10 +463,8 @@ protected LocatedBlock refreshLocatedBlock(LocatedBlock block)
break; break;
} }
} }
if (DFSClient.LOG.isDebugEnabled()) { DFSClient.LOG.debug("refreshLocatedBlock for striped blocks, offset={}." +
DFSClient.LOG.debug("refreshLocatedBlock for striped blocks, offset=" " Obtained block {}, idx={}", block.getStartOffset(), lb, idx);
+ block.getStartOffset() + ". Obtained block " + lb + ", idx=" + idx);
}
return StripedBlockUtil.constructInternalBlock( return StripedBlockUtil.constructInternalBlock(
lsb, i, cellSize, dataBlkNum, idx); lsb, i, cellSize, dataBlkNum, idx);
} }
@ -526,7 +522,7 @@ protected void reportLostBlock(LocatedBlock lostBlock,
if (!warnedNodes.containsAll(dnUUIDs)) { if (!warnedNodes.containsAll(dnUUIDs)) {
DFSClient.LOG.warn(Arrays.toString(nodes) + " are unavailable and " + DFSClient.LOG.warn(Arrays.toString(nodes) + " are unavailable and " +
"all striping blocks on them are lost. " + "all striping blocks on them are lost. " +
"IgnoredNodes = " + ignoredNodes); "IgnoredNodes = {}", ignoredNodes);
warnedNodes.addAll(dnUUIDs); warnedNodes.addAll(dnUUIDs);
} }
} else { } else {

View File

@ -353,10 +353,8 @@ void readStripe() throws IOException {
StripingChunkReadResult r = StripedBlockUtil StripingChunkReadResult r = StripedBlockUtil
.getNextCompletedStripedRead(service, futures, 0); .getNextCompletedStripedRead(service, futures, 0);
dfsStripedInputStream.updateReadStats(r.getReadStats()); dfsStripedInputStream.updateReadStats(r.getReadStats());
if (DFSClient.LOG.isDebugEnabled()) { DFSClient.LOG.debug("Read task returned: {}, for stripe {}",
DFSClient.LOG.debug("Read task returned: " + r + ", for stripe " r, alignedStripe);
+ alignedStripe);
}
StripingChunk returnedChunk = alignedStripe.chunks[r.index]; StripingChunk returnedChunk = alignedStripe.chunks[r.index];
Preconditions.checkNotNull(returnedChunk); Preconditions.checkNotNull(returnedChunk);
Preconditions.checkState(returnedChunk.state == StripingChunk.PENDING); Preconditions.checkState(returnedChunk.state == StripingChunk.PENDING);