public BlockStoragePolicySuite getBlockStoragePolicySuite() { return getBlockManager().getStoragePolicySuite(); }
/** * Tell the block manager to update the replication factors when delete * happens. Deleting a file or a snapshot might decrease the replication * factor of the blocks as the blocks are always replicated to the highest * replication factor among all snapshots. */ void updateReplicationFactor(Collection<UpdatedReplicationInfo> blocks) { BlockManager bm = getBlockManager(); for (UpdatedReplicationInfo e : blocks) { BlockInfo b = e.block(); bm.setReplication(b.getReplication(), e.targetReplication(), b); } }
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; } }
static boolean unprotectedRemoveBlock( FSDirectory fsd, String path, INodesInPath iip, INodeFile fileNode, Block block) throws IOException { // modify file-> block and blocksMap // fileNode should be under construction BlockInfo uc = fileNode.removeLastBlock(block); if (uc == null) { return false; } if (uc.getUnderConstructionFeature() != null) { DatanodeStorageInfo.decrementBlocksScheduled(uc .getUnderConstructionFeature().getExpectedStorageLocations()); } fsd.getBlockManager().removeBlockFromMap(uc); if(NameNode.stateChangeLog.isDebugEnabled()) { NameNode.stateChangeLog.debug("DIR* FSDirectory.removeBlock: " +path+" with "+block +" block is removed from the file system"); } // update space consumed fsd.updateCount(iip, 0, -fileNode.getPreferredBlockSize(), fileNode.getPreferredBlockReplication(), true); return true; }
BlockStoragePolicy storagePolicy = getBlockManager().getStoragePolicy(storagePolicyID);
assert fsd.hasWriteLock(); final BlockManager bm = fsd.getBlockManager(); final INode inode = iip.getLastINode(); if (inode == null || !inode.isFile() || inode.asFile().isStriped()) {
fsd.getBlockManager().getSPSManager(); if (spsManager != null) { spsManager.addPathId(inode.getId());
HdfsServerConstants.BlockUCState.UNDER_CONSTRUCTION, targets); fsd.getBlockManager().addBlockCollection(blockInfo, fileINode); fileINode.addBlock(blockInfo);
BlockManager blockManager = fsd.getBlockManager(); final BlockStoragePolicy lpPolicy = blockManager .getStoragePolicy("LAZY_PERSIST");
XAttrSetFlag.CREATE); setNewINodeStoragePolicy(fsd.getBlockManager(), iip, isLazyPersist); fsd.getEditLog().logOpenFile(src, newNode, overwrite, logRetryEntry); if (NameNode.stateChangeLog.isDebugEnabled()) {
trgInode.concatBlocks(srcList, fsd.getBlockManager());
Preconditions.checkArgument(length >= 0, "Negative length is not supported. File: " + src); BlockManager bm = fsd.getBlockManager(); fsd.readLock(); try {
public BlockStoragePolicySuite getBlockStoragePolicySuite() { return getBlockManager().getStoragePolicySuite(); }
public BlockStoragePolicySuite getBlockStoragePolicySuite() { return getBlockManager().getStoragePolicySuite(); }
final long fileSize = !inSnapshot && isUc ? fileNode.computeFileSizeNotIncludingLastUcBlock() : size; loc = fsd.getBlockManager().createLocatedBlocks( fileNode.getBlocks(snapshot), fileSize, isUc, 0L, size, needBlockToken, inSnapshot, feInfo, ecPolicy);
&& !file.isBlockInLatestSnapshot(oldBlock)) { oldBlock.delete(); fsd.getBlockManager().removeBlockFromMap(oldBlock);
if (!newBlock) { FSDirectory fsd = fsn.getFSDirectory(); ret = fsd.getBlockManager().convertLastBlockToUnderConstruction(file, 0); if (ret != null && delta != null) { Preconditions.checkState(delta.getStorageSpace() >= 0, "appending to"
final BlockStoragePolicy lpPolicy = fsd.getBlockManager() .getStoragePolicy("LAZY_PERSIST");
BlockManager blockManager = fsn.getFSDirectory().getBlockManager(); if (shouldCopyOnTruncate) {
boolean unprotectedRemoveBlock(String path, INodesInPath iip, INodeFile fileNode, Block block) throws IOException { // modify file-> block and blocksMap // fileNode should be under construction boolean removed = fileNode.removeLastBlock(block); if (!removed) { return false; } getBlockManager().removeBlockFromMap(block); if(NameNode.stateChangeLog.isDebugEnabled()) { NameNode.stateChangeLog.debug("DIR* FSDirectory.removeBlock: " +path+" with "+block +" block is removed from the file system"); } // update space consumed updateCount(iip, 0, -fileNode.getPreferredBlockSize(), fileNode.getBlockReplication(), true); return true; }