/** * Return true if the block is a striped block. * * Before HDFS-4645, block ID was randomly generated (legacy), so it is * possible that legacy block ID to be negative, which should not be * considered as striped block ID. * * @see #isLegacyBlock(Block) detecting legacy block IDs. */ public boolean isStripedBlock(Block block) { return isStripedBlockID(block.getBlockId()) && !isLegacyBlock(block); }
/** * Do some check when adding a block to blocksmap. * For HDFS-7994 to check whether then block is a NonEcBlockUsingStripedID. * */ public BlockInfo addBlockCollectionWithCheck( BlockInfo block, BlockCollection bc) { if (!hasNonEcBlockUsingStripedID && !block.isStriped() && BlockIdManager.isStripedBlockID(block.getBlockId())) { hasNonEcBlockUsingStripedID = true; } return addBlockCollection(block, bc); }
if (BlockIdManager.isStripedBlockID(replicaID) && (!hasNonEcBlockUsingStripedID || !blocksMap.containsBlock(replica))) {
@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; }
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()))); }
assert BlockIdManager.isStripedBlockID(reported.getBlockId()); assert storedBlock.getBlockId() == BlockIdManager.convertToStripedID(reported.getBlockId());
if (BlockIdManager.isStripedBlockID(allocateBlockIdOp.blockId)) {