From 71c49b17869200c5c50bb4ce5569e2e14b59f285 Mon Sep 17 00:00:00 2001 From: Yongjun Zhang Date: Wed, 27 Jul 2016 13:58:04 -0700 Subject: [PATCH] HDFS-10667. Report more accurate info about data corruption location. (Yuanbo Liu via Yongjun Zhang) (cherry picked from commit eb7ff0c9927131f4a797148b970a95a1abf7d847) --- .../apache/hadoop/hdfs/server/datanode/BlockReceiver.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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 a60d1886409..fc4b665f2dc 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 @@ -462,7 +462,13 @@ class BlockReceiver implements Closeable { try { clientChecksum.verifyChunkedSums(dataBuf, checksumBuf, clientname, 0); } catch (ChecksumException ce) { - LOG.warn("Checksum error in block " + block + " from " + inAddr, ce); + PacketHeader header = packetReceiver.getHeader(); + String specificOffset = "specific offsets are:" + + " offsetInBlock = " + header.getOffsetInBlock() + + " offsetInPacket = " + ce.getPos(); + LOG.warn("Checksum error in block " + + block + " from " + inAddr + + ", " + specificOffset, ce); // No need to report to namenode when client is writing. if (srcDataNode != null && isDatanode) { try {