From 462e25a3b264e1148d0cbca00db7f10d43a0555f Mon Sep 17 00:00:00 2001 From: Weiwei Yang Date: Thu, 16 Nov 2017 16:19:53 +0800 Subject: [PATCH] HDFS-12814. Add blockId when warning slow mirror/disk in BlockReceiver. Contributed by Jiandan Yang. --- .../hdfs/server/datanode/BlockReceiver.java | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/BlockReceiver.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/BlockReceiver.java index 8d91f04474..c052d52cf9 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/BlockReceiver.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/BlockReceiver.java @@ -434,7 +434,8 @@ void flushOrSync(boolean isSync) throws IOException { if (duration > datanodeSlowLogThresholdMs && LOG.isWarnEnabled()) { LOG.warn("Slow flushOrSync took " + duration + "ms (threshold=" + datanodeSlowLogThresholdMs + "ms), isSync:" + isSync + ", flushTotalNanos=" - + flushTotalNanos + "ns, volume=" + getVolumeBaseUri()); + + flushTotalNanos + "ns, volume=" + getVolumeBaseUri() + + ", blockId=" + replicaInfo.getBlockId()); } } @@ -591,7 +592,8 @@ private int receivePacket() throws IOException { if (duration > datanodeSlowLogThresholdMs && LOG.isWarnEnabled()) { LOG.warn("Slow BlockReceiver write packet to mirror took " + duration + "ms (threshold=" + datanodeSlowLogThresholdMs + "ms), " - + "downstream DNs=" + Arrays.toString(downstreamDNs)); + + "downstream DNs=" + Arrays.toString(downstreamDNs) + + ", blockId=" + replicaInfo.getBlockId()); } } catch (IOException e) { handleMirrorOutError(e); @@ -725,7 +727,8 @@ private int receivePacket() throws IOException { if (duration > datanodeSlowLogThresholdMs && LOG.isWarnEnabled()) { LOG.warn("Slow BlockReceiver write data to disk cost:" + duration + "ms (threshold=" + datanodeSlowLogThresholdMs + "ms), " - + "volume=" + getVolumeBaseUri()); + + "volume=" + getVolumeBaseUri() + + ", blockId=" + replicaInfo.getBlockId()); } if (duration > maxWriteToDiskMs) { @@ -917,7 +920,8 @@ private void manageWriterOsCache(long offsetInBlock) { if (duration > datanodeSlowLogThresholdMs && LOG.isWarnEnabled()) { LOG.warn("Slow manageWriterOsCache took " + duration + "ms (threshold=" + datanodeSlowLogThresholdMs - + "ms), volume=" + getVolumeBaseUri()); + + "ms), volume=" + getVolumeBaseUri() + + ", blockId=" + replicaInfo.getBlockId()); } } } catch (Throwable t) { @@ -1629,7 +1633,9 @@ private void sendAckUpstreamUnprotected(PipelineAck ack, long seqno, if (duration > datanodeSlowLogThresholdMs) { LOG.warn("Slow PacketResponder send ack to upstream took " + duration + "ms (threshold=" + datanodeSlowLogThresholdMs + "ms), " + myString - + ", replyAck=" + replyAck); + + ", replyAck=" + replyAck + + ", downstream DNs=" + Arrays.toString(downstreamDNs) + + ", blockId=" + replicaInfo.getBlockId()); } else if (LOG.isDebugEnabled()) { LOG.debug(myString + ", replyAck=" + replyAck); }