HDFS-14808. EC: Improper size values for corrupt ec block in LOG. Contributed by Ayush Saxena.
This commit is contained in:
parent
eb96a3093e
commit
66400c1cbb
|
@ -3159,23 +3159,26 @@ public class BlockManager implements BlockStatsMXBean {
|
||||||
+ storedBlock.getGenerationStamp(), Reason.GENSTAMP_MISMATCH);
|
+ storedBlock.getGenerationStamp(), Reason.GENSTAMP_MISMATCH);
|
||||||
}
|
}
|
||||||
boolean wrongSize;
|
boolean wrongSize;
|
||||||
|
long blockMapSize;
|
||||||
if (storedBlock.isStriped()) {
|
if (storedBlock.isStriped()) {
|
||||||
assert BlockIdManager.isStripedBlockID(reported.getBlockId());
|
assert BlockIdManager.isStripedBlockID(reported.getBlockId());
|
||||||
assert storedBlock.getBlockId() ==
|
assert storedBlock.getBlockId() ==
|
||||||
BlockIdManager.convertToStripedID(reported.getBlockId());
|
BlockIdManager.convertToStripedID(reported.getBlockId());
|
||||||
BlockInfoStriped stripedBlock = (BlockInfoStriped) storedBlock;
|
BlockInfoStriped stripedBlock = (BlockInfoStriped) storedBlock;
|
||||||
int reportedBlkIdx = BlockIdManager.getBlockIndex(reported);
|
int reportedBlkIdx = BlockIdManager.getBlockIndex(reported);
|
||||||
wrongSize = reported.getNumBytes() != getInternalBlockLength(
|
blockMapSize = getInternalBlockLength(stripedBlock.getNumBytes(),
|
||||||
stripedBlock.getNumBytes(), stripedBlock.getCellSize(),
|
stripedBlock.getCellSize(), stripedBlock.getDataBlockNum(),
|
||||||
stripedBlock.getDataBlockNum(), reportedBlkIdx);
|
reportedBlkIdx);
|
||||||
|
wrongSize = reported.getNumBytes() != blockMapSize;
|
||||||
} else {
|
} else {
|
||||||
wrongSize = storedBlock.getNumBytes() != reported.getNumBytes();
|
blockMapSize = storedBlock.getNumBytes();
|
||||||
|
wrongSize = blockMapSize != reported.getNumBytes();
|
||||||
}
|
}
|
||||||
if (wrongSize) {
|
if (wrongSize) {
|
||||||
return new BlockToMarkCorrupt(new Block(reported), storedBlock,
|
return new BlockToMarkCorrupt(new Block(reported), storedBlock,
|
||||||
"block is " + ucState + " and reported length " +
|
"block is " + ucState + " and reported length " +
|
||||||
reported.getNumBytes() + " does not match " +
|
reported.getNumBytes() + " does not match " +
|
||||||
"length in block map " + storedBlock.getNumBytes(),
|
"length in block map " + blockMapSize,
|
||||||
Reason.SIZE_MISMATCH);
|
Reason.SIZE_MISMATCH);
|
||||||
} else {
|
} else {
|
||||||
return null; // not corrupt
|
return null; // not corrupt
|
||||||
|
|
Loading…
Reference in New Issue