Details
-
Sub-task
-
Status: Resolved
-
Critical
-
Resolution: Fixed
-
None
-
None
-
None
-
Reviewed
Description
Currently when calculating isNeededReplication for striped block, we use BlockCollection#getPreferredBlockReplication to get expected replica number for striped block. See an example:
public void checkReplication(BlockCollection bc) { final short expected = bc.getPreferredBlockReplication(); for (BlockInfo block : bc.getBlocks()) { final NumberReplicas n = countNodes(block); if (isNeededReplication(block, expected, n.liveReplicas())) { neededReplications.add(block, n.liveReplicas(), n.decommissionedAndDecommissioning(), expected); } else if (n.liveReplicas() > expected) { processOverReplicatedBlock(block, expected, null, null); } } }
But actually it's not correct, for example, if the length of striped file is less than a cell, then the expected replica of the block should be 1 + parityBlkNum instead of dataBlkNum + parityBlkNum.