HDFS-12771. Add genstamp and block size to metasave Corrupt blocks list. Contributed by Kuhu Shukla.

This commit is contained in:
Kihwal Lee 2017-11-03 15:16:46 -05:00
parent 299d38295d
commit 4d2dce40bb
2 changed files with 8 additions and 6 deletions

View File

@ -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) {

View File

@ -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();