diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/BlockManager.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/BlockManager.java index 6cd67f6fe0..bdabd81688 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/BlockManager.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/BlockManager.java @@ -775,10 +775,11 @@ public class BlockManager implements BlockStatsMXBean { String storageId = storage.getStorageID(); DatanodeStorageInfo storageInfo = node.getStorageInfo(storageId); State state = (storageInfo == null) ? null : storageInfo.getState(); - out.println("Block=" + block.getBlockId() + "\tNode=" + node.getName() - + "\tStorageID=" + storageId + "\tStorageState=" + state - + "\tTotalReplicas=" + - blocksMap.numNodes(block) + out.println("Block=" + block.toString() + + "\tSize=" + block.getNumBytes() + + "\tNode=" + node.getName() + "\tStorageID=" + storageId + + "\tStorageState=" + state + + "\tTotalReplicas=" + blocksMap.numNodes(block) + "\tReason=" + corruptReplicas.getCorruptReason(block, node)); numNodesToFind--; if (numNodesToFind == 0) { diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/blockmanagement/TestBlockManager.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/blockmanagement/TestBlockManager.java index 4d01d80d1d..f63be91f27 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/blockmanagement/TestBlockManager.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/blockmanagement/TestBlockManager.java @@ -1318,8 +1318,9 @@ public class TestBlockManager { assertTrue("Unexpected text in metasave," + "was expecting corrupt blocks section!", foundIt); corruptBlocksLine = reader.readLine(); - String regex = "Block=[0-9]+\\tNode=.*\\tStorageID=.*StorageState.*" + - "TotalReplicas=.*Reason=GENSTAMP_MISMATCH"; + String regex = "Block=blk_[0-9]+_[0-9]+\\tSize=.*\\tNode=.*" + + "\\tStorageID=.*\\tStorageState.*" + + "\\tTotalReplicas=.*\\tReason=GENSTAMP_MISMATCH"; assertTrue("Unexpected corrupt block section in metasave!", corruptBlocksLine.matches(regex)); corruptBlocksLine = reader.readLine();