Skip to content

Commit 66400c1

Browse files
committed
HDFS-14808. EC: Improper size values for corrupt ec block in LOG. Contributed by Ayush Saxena.
1 parent eb96a30 commit 66400c1

File tree

1 file changed

+8
-5
lines changed
  • hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement

1 file changed

+8
-5
lines changed

hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/BlockManager.java

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3159,23 +3159,26 @@ private BlockToMarkCorrupt checkReplicaCorrupt(
31593159
+ storedBlock.getGenerationStamp(), Reason.GENSTAMP_MISMATCH);
31603160
}
31613161
boolean wrongSize;
3162+
long blockMapSize;
31623163
if (storedBlock.isStriped()) {
31633164
assert BlockIdManager.isStripedBlockID(reported.getBlockId());
31643165
assert storedBlock.getBlockId() ==
31653166
BlockIdManager.convertToStripedID(reported.getBlockId());
31663167
BlockInfoStriped stripedBlock = (BlockInfoStriped) storedBlock;
31673168
int reportedBlkIdx = BlockIdManager.getBlockIndex(reported);
3168-
wrongSize = reported.getNumBytes() != getInternalBlockLength(
3169-
stripedBlock.getNumBytes(), stripedBlock.getCellSize(),
3170-
stripedBlock.getDataBlockNum(), reportedBlkIdx);
3169+
blockMapSize = getInternalBlockLength(stripedBlock.getNumBytes(),
3170+
stripedBlock.getCellSize(), stripedBlock.getDataBlockNum(),
3171+
reportedBlkIdx);
3172+
wrongSize = reported.getNumBytes() != blockMapSize;
31713173
} else {
3172-
wrongSize = storedBlock.getNumBytes() != reported.getNumBytes();
3174+
blockMapSize = storedBlock.getNumBytes();
3175+
wrongSize = blockMapSize != reported.getNumBytes();
31733176
}
31743177
if (wrongSize) {
31753178
return new BlockToMarkCorrupt(new Block(reported), storedBlock,
31763179
"block is " + ucState + " and reported length " +
31773180
reported.getNumBytes() + " does not match " +
3178-
"length in block map " + storedBlock.getNumBytes(),
3181+
"length in block map " + blockMapSize,
31793182
Reason.SIZE_MISMATCH);
31803183
} else {
31813184
return null; // not corrupt

0 commit comments

Comments
 (0)