@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); }
void setLastBlock(BlockInfo blk) { blk.setBlockCollectionId(this.getId()); setBlock(numBlocks() - 1, blk); }
static boolean unprotectedSatisfyStoragePolicy(INode inode, FSDirectory fsd) { if (inode.isFile() && inode.asFile().numBlocks() == 0) { return false; } else { // Adding directory in the pending queue, so FileInodeIdCollector process // directory child in batch and recursively StoragePolicySatisfyManager spsManager = fsd.getBlockManager().getSPSManager(); if (spsManager != null) { spsManager.addPathId(inode.getId()); } return true; } }
if (inode.isFile() && inode.asFile().numBlocks() == 0) { if (NameNode.LOG.isInfoEnabled()) { NameNode.LOG.info(
if(srcINodeFile.isUnderConstruction() || srcINodeFile.numBlocks() == 0) { throw new HadoopIllegalArgumentException("concat: source file " + src + " is invalid or empty or underConstruction");
int nrBlocks = pendingFile.numBlocks(); BlockInfo[] blocks = pendingFile.getBlocks();
@Override // BlockCollection, the file should be under construction public BlockInfoContiguousUnderConstruction setLastBlock( BlockInfoContiguous 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."); } BlockInfoContiguousUnderConstruction ucBlock = lastBlock.convertToBlockUnderConstruction( BlockUCState.UNDER_CONSTRUCTION, locations); setBlock(numBlocks() - 1, ucBlock); return ucBlock; }
file.setBlock(file.numBlocks() - 1, ucBlk);
@Override // BlockCollection, the file should be under construction public BlockInfoContiguousUnderConstruction setLastBlock( BlockInfoContiguous 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."); } BlockInfoContiguousUnderConstruction ucBlock = lastBlock.convertToBlockUnderConstruction( BlockUCState.UNDER_CONSTRUCTION, locations); setBlock(numBlocks() - 1, ucBlock); return ucBlock; }
@Test public void testConcatBlocks() { INodeFile origFile = createINodeFiles(1, "origfile")[0]; assertEquals("Number of blocks didn't match", origFile.numBlocks(), 1L); INodeFile[] appendFiles = createINodeFiles(4, "appendfile"); origFile.concatBlocks(appendFiles); assertEquals("Number of blocks didn't match", origFile.numBlocks(), 5L); }
if(srcINodeFile.isUnderConstruction() || srcINodeFile.numBlocks() == 0) { throw new HadoopIllegalArgumentException("concat: source file " + src + " is invalid or empty or underConstruction");
if(srcINodeFile.isUnderConstruction() || srcINodeFile.numBlocks() == 0) { throw new HadoopIllegalArgumentException("concat: source file " + src + " is invalid or empty or underConstruction");
BlockInfoContiguous lastBlk = file.getLastBlock(); file.setBlock(file.numBlocks() - 1, new BlockInfoContiguousUnderConstruction( lastBlk, replication));
int nrBlocks = pendingFile.numBlocks(); BlockInfoContiguous[] blocks = pendingFile.getBlocks();
BlockInfoContiguous lastBlk = file.getLastBlock(); file.setBlock(file.numBlocks() - 1, new BlockInfoContiguousUnderConstruction( lastBlk, replication));
int nrBlocks = pendingFile.numBlocks(); BlockInfoContiguous[] blocks = pendingFile.getBlocks();