/** * Get {@link INode} associated with the file / directory. * See {@link #getINode(String, DirOp)} */ @VisibleForTesting // should be removed after a lot of tests are updated public INode getINode(String src) throws UnresolvedLinkException, AccessControlException, ParentNotDirectoryException { return getINode(src, DirOp.READ); }
final String path = renameReservedPathsOnUpgrade(reassignLeaseOp.path, logVersion); INodeFile pendingFile = fsDir.getINode(path, DirOp.READ).asFile(); Preconditions.checkState(pendingFile.isUnderConstruction()); fsNamesys.reassignLeaseInternal(lease, reassignLeaseOp.newHolder,
/** * Get {@link INode} associated with the file / directory. * See {@link #getINode(String, DirOp)} */ @VisibleForTesting // should be removed after a lot of tests are updated public INode getINode4Write(String src) throws UnresolvedLinkException, AccessControlException, FileNotFoundException, ParentNotDirectoryException { return getINode(src, DirOp.WRITE); }
try { if (fullName != null && fullName.startsWith(Path.SEPARATOR) && dir.getINode(fullName, DirOp.READ) == bc) {
/** * Load all children of a directory * * @param in input to load from * @param counter Counter to increment for namenode startup progress * @return number of child inodes read * @throws IOException */ private int loadDirectory(DataInput in, Counter counter) throws IOException { String parentPath = FSImageSerialization.readString(in); // Rename .snapshot paths if we're doing an upgrade parentPath = renameReservedPathsOnUpgrade(parentPath, getLayoutVersion()); final INodeDirectory parent = INodeDirectory.valueOf( namesystem.dir.getINode(parentPath, DirOp.READ), parentPath); return loadChildren(parent, in, counter); }
if (snapshottableDirs != null) { for (String snap : snapshottableDirs) { final INode isnap = getFSDirectory().getINode(snap, DirOp.READ_LINK); final DirectorySnapshottableFeature sf = isnap.asDirectory().getDirectorySnapshottableFeature();
INode node; try { node = fsDir.getINode(path, DirOp.READ); } catch (IOException e) {
/** * Get {@link INode} associated with the file / directory. */ public INode getINode(String src) throws UnresolvedLinkException { return getINode(src, true); }
/** * Get {@link INode} associated with the file / directory. */ public INode getINode(String src) throws UnresolvedLinkException { return getINode(src, true); }
CacheDirectiveStats.Builder builder = new CacheDirectiveStats.Builder(); try { node = fsDir.getINode(path, DirOp.READ); } catch (IOException e) {
private static INodeDirectory getDir(final FSDirectory fsdir, final Path dir) throws IOException { final String dirStr = dir.toString(); return INodeDirectory.valueOf(fsdir.getINode(dirStr), dirStr); }
public static void dumpTree2File(FSDirectory fsdir, File f) throws IOException{ final PrintWriter out = new PrintWriter(new FileWriter(f, false), true); fsdir.getINode("/").dumpTreeRecursively(out, new StringBuilder(), Snapshot.CURRENT_STATE_ID); out.close(); }
INodeFile getINodeFile(Path p) throws Exception { final String s = p.toString(); return INodeFile.valueOf(fsdir.getINode(s), s); }
private static INodeDirectory getDir(final FSDirectory fsdir, final Path dir) throws IOException { final String dirStr = dir.toString(); return INodeDirectory.valueOf(fsdir.getINode(dirStr), dirStr); }
void assertINodeNull(String path) throws Exception { Assert.assertNull(fsdir.getINode(path)); }
/** * Check whether the path specifies a directory */ boolean isDir(String src) throws UnresolvedLinkException { src = normalizePath(src); readLock(); try { INode node = getINode(src, false); return node != null && node.isDirectory(); } finally { readUnlock(); } }
/** * Get AclFeature for the path */ public static AclFeature getAclFeature(Path pathToCheck, MiniDFSCluster cluster) throws IOException { INode inode = cluster.getNamesystem().getFSDirectory() .getINode(pathToCheck.toUri().getPath(), false); assertNotNull(inode); AclFeature aclFeature = inode.getAclFeature(); return aclFeature; }
public static void dumpTree(String message, MiniDFSCluster cluster ) throws UnresolvedLinkException { System.out.println("XXX " + message); cluster.getNameNode().getNamesystem().getFSDirectory().getINode("/" ).dumpTreeRecursively(System.out); } }
static INodeFile assertBlockCollection(String path, int numBlocks, final FSDirectory dir, final BlockManager blkManager) throws Exception { final INodeFile file = INodeFile.valueOf(dir.getINode(path), path); assertEquals(numBlocks, file.getBlocks().length); for(BlockInfoContiguous b : file.getBlocks()) { assertBlockCollection(blkManager, file, b); } return file; }
boolean checkFileProgress(String src, boolean checkall) throws IOException { final FSNamesystem ns = cluster.getNamesystem(); ns.readLock(); try { return ns.checkFileProgress(src, ns.dir.getINode(src).asFile(), checkall); } finally { ns.readUnlock(); } }