@Override // BlockCollection, the file should be under construction public void convertLastBlockToUC(BlockInfo lastBlock, DatanodeStorageInfo[] locations) throws IOException { Preconditions.checkState(isUnderConstruction(), "file is no longer under construction"); if (numBlocks() == 0) { throw new IOException("Failed to set last block: File is empty."); } lastBlock.convertToBlockUnderConstruction(BlockUCState.UNDER_CONSTRUCTION, locations); }
numLocations, true); blockInfo = new BlockInfoStriped(block, ecPolicy); blockInfo.convertToBlockUnderConstruction( HdfsServerConstants.BlockUCState.UNDER_CONSTRUCTION, targets); } else { blockInfo.convertToBlockUnderConstruction( HdfsServerConstants.BlockUCState.UNDER_CONSTRUCTION, targets);
lastBlk.convertToBlockUnderConstruction( HdfsServerConstants.BlockUCState.UNDER_CONSTRUCTION, null);
file.getPreferredBlockReplication()); newBlockInfo.convertToBlockUnderConstruction( BlockUCState.UNDER_CONSTRUCTION, null); fsNamesys.getBlockManager().addBlockCollectionWithCheck(newBlockInfo, file);
file.getPreferredBlockReplication()); newBI.convertToBlockUnderConstruction( BlockUCState.UNDER_CONSTRUCTION, null); } else {
replication); ucBlk.convertToBlockUnderConstruction( HdfsServerConstants.BlockUCState.UNDER_CONSTRUCTION, null); file.setBlock(file.numBlocks() - 1, ucBlk);
truncatedBlockUC.convertToBlockUnderConstruction( BlockUCState.UNDER_CONSTRUCTION, blockManager.getStorages(oldBlock)); truncatedBlockUC.setNumBytes(oldBlock.getNumBytes() - lastBlockDelta);