boolean hdfsPathExists(String path) throws AccessControlException, UnresolvedLinkException, IOException { try { HdfsFileStatus hfs = namenode.getRpcServer().getFileInfo(path); return (hfs != null); } catch (FileNotFoundException e) { return false; } }
final HdfsFileStatus file = namenode.getRpcServer().getFileInfo(path); if (file != null) {
private void checkDir(String path, Result replRes, Result ecRes) throws IOException { if (snapshottableDirs != null && snapshottableDirs.contains(path)) { String snapshotPath = (path.endsWith(Path.SEPARATOR) ? path : path + Path.SEPARATOR) + HdfsConstants.DOT_SNAPSHOT_DIR; HdfsFileStatus snapshotFileInfo = namenode.getRpcServer().getFileInfo( snapshotPath); check(snapshotPath, snapshotFileInfo, replRes, ecRes); } byte[] lastReturnedName = HdfsFileStatus.EMPTY_NAME; DirectoryListing thisListing; if (showFiles) { out.println(path + " <dir>"); } totalDirs++; do { assert lastReturnedName != null; thisListing = namenode.getRpcServer().getListing( path, lastReturnedName, false); if (thisListing == null) { return; } HdfsFileStatus[] files = thisListing.getPartialListing(); for (int i = 0; i < files.length; i++) { check(path, files[i], replRes, ecRes); } lastReturnedName = thisListing.getLastName(); } while (thisListing.hasMore()); }
|| op == GetOpParam.Op.GETFILECHECKSUM || op == PostOpParam.Op.APPEND) { status = np.getFileInfo(path);
boolean hdfsPathExists(String path) throws AccessControlException, UnresolvedLinkException, IOException { try { HdfsFileStatus hfs = namenode.getRpcServer().getFileInfo(path); return (hfs != null); } catch (FileNotFoundException e) { return false; } }
boolean hdfsPathExists(String path) throws AccessControlException, UnresolvedLinkException, IOException { try { HdfsFileStatus hfs = namenode.getRpcServer().getFileInfo(path); return (hfs != null); } catch (FileNotFoundException e) { return false; } }
final HdfsFileStatus file = namenode.getRpcServer().getFileInfo(path); if (file != null) {
final HdfsFileStatus status = np.getFileInfo(path); if (status == null) { throw new FileNotFoundException("File " + path + " not found.");
new HdfsFileStatus(0, false, 1, 1024, 0, 0, new FsPermission( (short) 777), "owner", "group", new byte[0], new byte[0], 1010, 0, null, (byte) 0)).when(mockNN).getFileInfo(anyString());
final HdfsFileStatus status = np.getFileInfo(path); if (status == null) { throw new FileNotFoundException("File " + path + " not found.");
new PermissionStatus("hairong", null, FsPermission.getDefault()), true); NamenodeProtocols nnRpc = namenode.getRpcServer(); assertTrue(nnRpc.getFileInfo("/test").isDir()); nnRpc.setSafeMode(SafeModeAction.SAFEMODE_ENTER, false); nnRpc.saveNamespace();
DFSTestUtil.createFile(dfs, filePath1, trgFileLen, REPL_FACTOR, 1); HdfsFileStatus fStatus = nn.getFileInfo(name1); long fileLen = fStatus.getLen(); assertEquals(fileLen, trgFileLen); fStatus = nn.getFileInfo(name2); fileLen = fStatus.getLen(); assertEquals(srcFileLen, fileLen); fStatus = nn.getFileInfo(name1); fileLen = fStatus.getLen(); fStatus = nn.getFileInfo(name2); assertNull("File "+name2+ "still exists", fStatus); // file shouldn't exist
private void checkNameSpace(Configuration conf) throws IOException { NameNode namenode = new NameNode(conf); NamenodeProtocols nnRpc = namenode.getRpcServer(); assertTrue(nnRpc.getFileInfo("/test").isDir()); nnRpc.setSafeMode(SafeModeAction.SAFEMODE_ENTER, false); nnRpc.saveNamespace(); namenode.stop(); namenode.join(); }
assertNotNull(cluster.getNameNode(0).getRpcServer().getFileInfo(testPath));
namenode.getRpcServer().getFileInfo(pathString); assertNotNull(file); Result res = new Result(conf);
namenode.getRpcServer().getFileInfo(pathString); assertNotNull(file); Result res = new Result(conf);
try { nn1.getRpcServer().getFileInfo("/"); fail("Should have thrown StandbyException, but instead succeeded."); } catch (StandbyException se) {
nn2.getRpcServer().getFileInfo(TEST_FILE).getReplication());
nn2.getRpcServer().getFileInfo(TEST_FILE).getReplication());
nn2.getRpcServer().getFileInfo(TEST_FILE).getReplication());