@Override public String getName() { // Get the full path name of this inode. return getFullPathName(); }
void add(final INodeFile inode) throws IOException { assert dir.hasReadLock(); Preconditions.checkNotNull(inode, "INodeFile is null"); if (batch.isEmpty()) { firstFilePath = inode.getFullPathName(); } batch.add(new FileEdekInfo(dir, inode)); }
/** * Update the length for the last block * * @param lastBlockLength * The length of the last block reported from client * @throws IOException */ void updateLengthOfLastBlock(INodeFile f, long lastBlockLength) throws IOException { BlockInfo lastBlock = f.getLastBlock(); assert (lastBlock != null) : "The last block for path " + f.getFullPathName() + " is null when updating its length"; assert !lastBlock.isComplete() : "The last block for path " + f.getFullPathName() + " is not under-construction when updating its length"; lastBlock.setNumBytes(lastBlockLength); }
/** * Remove the lease for the specified holder and src */ synchronized void removeLease(String holder, INodeFile src) { Lease lease = getLease(holder); if (lease != null) { removeLease(lease, src.getId()); } else { LOG.warn("Removing non-existent lease! holder={} src={}", holder, src .getFullPathName()); } }
String path = file.getFullPathName(); FSImageSerialization.writeINodeUnderConstruction( out, file, path);
if (!inodeFile.isUnderConstruction()) { LOG.warn("The file {} is not under construction but has lease.", inodeFile.getFullPathName()); continue; fullPathName = inodeFile.getFullPathName(); if (StringUtils.isEmpty(path) || fullPathName.startsWith(path)) { openFileEntries.add(new OpenFileEntry(inodeFile.getId(), fullPathName,
skip++; if (inode != null) { String src = inode.getFullPathName(); if (src.startsWith(path)){ corruptFiles.add(new CorruptFileBlockInfo(src, blk));
if (!cons.isUnderConstruction()) { LOG.warn("The file {} is not under construction but has lease.", cons.getFullPathName()); continue;
NumberReplicas numberReplicas= blockManager.countNodes(blockInfo); out.println("Block Id: " + blockId); out.println("Block belongs to: "+iNode.getFullPathName()); out.println("No. of Expected Replica: " + blockManager.getExpectedRedundancyNum(blockInfo));
INodeFile inodeFile = ucFile.asFile(); String fullPathName = inodeFile.getFullPathName(); if (org.apache.commons.lang3.StringUtils.isEmpty(path) || fullPathName.startsWith(path)) { openFileEntries.add(new OpenFileEntry(inodeFile.getId(), inodeFile.getFullPathName(), inodeFile.getFileUnderConstructionFeature().getClientName(), inodeFile.getFileUnderConstructionFeature().getClientMachine()));
@Override public String getName() { // Get the full path name of this inode. return getFullPathName(); }
@Override public String getName() { // Get the full path name of this inode. return getFullPathName(); }
final String src = pendingFile.getFullPathName(); final BlockInfo lastBlock = pendingFile.getLastBlock(); assert !lastBlock.isComplete();
void serializeFilesUCSection(OutputStream out) throws IOException { Collection<Long> filesWithUC = fsn.getLeaseManager() .getINodeIdWithLeases(); for (Long id : filesWithUC) { INode inode = fsn.getFSDirectory().getInode(id); if (inode == null) { LOG.warn("Fail to find inode " + id + " when saving the leases."); continue; } INodeFile file = inode.asFile(); if (!file.isUnderConstruction()) { LOG.warn("Fail to save the lease for inode id " + id + " as the file is not under construction"); continue; } String path = file.getFullPathName(); FileUnderConstructionEntry.Builder b = FileUnderConstructionEntry .newBuilder().setInodeId(file.getId()).setFullPath(path); FileUnderConstructionEntry e = b.build(); e.writeDelimitedTo(out); } parent.commitSection(summary, FSImageFormatProtobuf.SectionName.FILES_UNDERCONSTRUCTION); }
"bytesNeeded for pool {} is {}, but the pool's limit is {}", directive.getId(), file.getFullPathName(), pool.getPoolName(), pool.getBytesNeeded(), file.getFullPathName(), cachedTotal, neededTotal);
src = iFile.getFullPathName(); if (isFileDeleted(iFile)) { throw new FileNotFoundException("File not found: "
/** * Update the length for the last block * * @param lastBlockLength * The length of the last block reported from client * @throws IOException */ void updateLengthOfLastBlock(INodeFile f, long lastBlockLength) throws IOException { BlockInfoContiguous lastBlock = f.getLastBlock(); assert (lastBlock != null) : "The last block for path " + f.getFullPathName() + " is null when updating its length"; assert (lastBlock instanceof BlockInfoContiguousUnderConstruction) : "The last block for path " + f.getFullPathName() + " is not a BlockInfoUnderConstruction when updating its length"; lastBlock.setNumBytes(lastBlockLength); }
/** * Update the length for the last block * * @param lastBlockLength * The length of the last block reported from client * @throws IOException */ void updateLengthOfLastBlock(INodeFile f, long lastBlockLength) throws IOException { BlockInfoContiguous lastBlock = f.getLastBlock(); assert (lastBlock != null) : "The last block for path " + f.getFullPathName() + " is null when updating its length"; assert (lastBlock instanceof BlockInfoContiguousUnderConstruction) : "The last block for path " + f.getFullPathName() + " is not a BlockInfoUnderConstruction when updating its length"; lastBlock.setNumBytes(lastBlockLength); }
/** * Wrapper function for choosing targets for replication. */ private DatanodeDescriptor[] chooseTarget(ReplicationWork work) { if (!neededReplications.contains(work.block)) { return null; } if (work.blockSize == BlockFlags.NO_ACK) { LOG.warn("Block " + work.block.getBlockId() + " of the file " + work.fileINode.getFullPathName() + " is invalidated and cannot be replicated."); return null; } if (work.blockSize == BlockFlags.DELETED) { LOG.warn("Block " + work.block.getBlockId() + " of the file " + work.fileINode.getFullPathName() + " is a deleted block and cannot be replicated."); return null; } return replicator.chooseTarget(work.fileINode, work.numOfReplicas, work.srcNode, work.containingNodes, null, work.blockSize); }
@Test public void testGetFullPathName() { replication = 3; preferredBlockSize = 128*1024*1024; INodeFile inf = createINodeFile(replication, preferredBlockSize); inf.setLocalName(DFSUtil.string2Bytes("f")); INodeDirectory root = new INodeDirectory(INodeId.GRANDFATHER_INODE_ID, INodeDirectory.ROOT_NAME, perm, 0L); INodeDirectory dir = new INodeDirectory(INodeId.GRANDFATHER_INODE_ID, DFSUtil.string2Bytes("d"), perm, 0L); assertEquals("f", inf.getFullPathName()); dir.addChild(inf); assertEquals("d"+Path.SEPARATOR+"f", inf.getFullPathName()); root.addChild(dir); assertEquals(Path.SEPARATOR+"d"+Path.SEPARATOR+"f", inf.getFullPathName()); assertEquals(Path.SEPARATOR+"d", dir.getFullPathName()); assertEquals(Path.SEPARATOR, root.getFullPathName()); }