public BlockInfo getStoredBlock(Block block) { if (!BlockIdManager.isStripedBlockID(block.getBlockId())) { return blocksMap.getStoredBlock(block); } if (!hasNonEcBlockUsingStripedID) { return blocksMap.getStoredBlock( new Block(BlockIdManager.convertToStripedID(block.getBlockId()))); } BlockInfo info = blocksMap.getStoredBlock(block); if (info != null) { return info; } return blocksMap.getStoredBlock( new Block(BlockIdManager.convertToStripedID(block.getBlockId()))); }
&& (!hasNonEcBlockUsingStripedID || !blocksMap.containsBlock(replica))) { replicaID = BlockIdManager.convertToStripedID(replicaID);
@Override boolean addStorage(DatanodeStorageInfo storage, Block reportedBlock) { Preconditions.checkArgument(BlockIdManager.isStripedBlockID( reportedBlock.getBlockId()), "reportedBlock is not striped"); Preconditions.checkArgument(BlockIdManager.convertToStripedID( reportedBlock.getBlockId()) == this.getBlockId(), "reported blk_%s does not belong to the group of stored blk_%s", reportedBlock.getBlockId(), this.getBlockId()); int blockIndex = BlockIdManager.getBlockIndex(reportedBlock); int index = blockIndex; DatanodeStorageInfo old = getStorageInfo(index); if (old != null && !old.equals(storage)) { // over replicated // check if the storage has been stored int i = findStorageInfo(storage); if (i == -1) { index = findSlot(); } else { return true; } } addStorage(storage, index, blockIndex); return true; }
assert BlockIdManager.isStripedBlockID(reported.getBlockId()); assert storedBlock.getBlockId() == BlockIdManager.convertToStripedID(reported.getBlockId()); BlockInfoStriped stripedBlock = (BlockInfoStriped) storedBlock; int reportedBlkIdx = BlockIdManager.getBlockIndex(reported);