HDFS-10667. Report more accurate info about data corruption location. (Yuanbo Liu via Yongjun Zhang)

This commit is contained in:
Yongjun Zhang 2016-07-27 13:58:04 -07:00
parent 54fe17a607
commit eb7ff0c992
1 changed files with 7 additions and 1 deletions

View File

@ -470,7 +470,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 {