@Override // ClientProtocol public HdfsFileStatus getFileLinkInfo(String src) throws IOException { checkNNStartup(); metrics.incrFileInfoOps(); return namesystem.getFileInfo(src, false, false, false); }
@Override // ClientProtocol public HdfsFileStatus getFileInfo(String src) throws IOException { checkNNStartup(); metrics.incrFileInfoOps(); return namesystem.getFileInfo(src, true, false, false); }
@Override // ClientProtocol public HdfsLocatedFileStatus getLocatedFileInfo(String src, boolean needBlockToken) throws IOException { checkNNStartup(); if (needBlockToken) { metrics.incrGetBlockLocations(); } else { metrics.incrFileInfoOps(); } return (HdfsLocatedFileStatus) namesystem.getFileInfo(src, true, true, needBlockToken); }
@Override // ClientProtocol public String getLinkTarget(String path) throws IOException { checkNNStartup(); metrics.incrGetLinkTargetOps(); HdfsFileStatus stat = null; try { stat = namesystem.getFileInfo(path, false, false, false); } catch (UnresolvedPathException e) { return e.getResolvedPath().toString(); } catch (UnresolvedLinkException e) { // The NameNode should only throw an UnresolvedPathException throw new AssertionError("UnresolvedLinkException thrown"); } if (stat == null) { throw new FileNotFoundException("File does not exist: " + path); } else if (!stat.isSymlink()) { throw new IOException("Path " + path + " is not a symbolic link"); } return DFSUtilClient.bytes2String(stat.getSymlinkInBytes()); }
fsd.getFSNamesystem().getFileInfo(snapname, true, false, false); if (stat != null) { snaps.add(snapname);
if (getFileInfo(c.path, true, false, false) != null) { list.add(c.toString());
/** * Get the file info for a specific file. * @param src The string representation of the path to the file * @throws IOException if permission to access file is denied by the system * @return object containing information regarding the file * or null if file not found */ public FileStatus getFileInfo(String src) throws IOException { return namesystem.getFileInfo(src); }
/** * Get the file info for a specific file. * @param src The string representation of the path to the file * @throws IOException if permission to access file is denied by the system * @return object containing information regarding the file * or null if file not found */ public FileStatus getFileInfo(String src) throws IOException { myMetrics.numFileInfoOps.inc(); return namesystem.getFileInfo(src); }
private void checkEditExists(FSNamesystem fsn, int id) throws IOException { // Make sure the image loaded including our edit. assertNotNull(fsn.getFileInfo("/test" + id, false)); }
@Override // ClientProtocol public HdfsFileStatus getFileLinkInfo(String src) throws IOException { checkNNStartup(); metrics.incrFileInfoOps(); return namesystem.getFileInfo(src, false); }
@Override // ClientProtocol public HdfsFileStatus getFileLinkInfo(String src) throws IOException { checkNNStartup(); metrics.incrFileInfoOps(); return namesystem.getFileInfo(src, false); }
@Override // ClientProtocol public HdfsFileStatus getFileInfo(String src) throws IOException { checkNNStartup(); metrics.incrFileInfoOps(); return namesystem.getFileInfo(src, true); }
@Override // ClientProtocol public HdfsFileStatus getFileInfo(String src) throws IOException { checkNNStartup(); metrics.incrFileInfoOps(); return namesystem.getFileInfo(src, true); }
private void listCorruptOpenFiles() throws IOException { int matchedCorruptFilesCount = 0; // directory representation of path String pathdir = path.endsWith(Path.SEPARATOR) ? path : path + Path.SEPARATOR; FileStatus pathFileStatus = nn.getNamesystem().getFileInfo(pathdir); List<FileStatus> corruptFileStatusList = new ArrayList<FileStatus>(); checkForCorruptOpenFiles(pathFileStatus, corruptFileStatusList); for (FileStatus fileStatus : corruptFileStatusList) { String currentPath = fileStatus.getPath().toString(); if (currentPath.startsWith(pathdir) || currentPath.equals(path)) { matchedCorruptFilesCount++; // print the header before listing first item if (matchedCorruptFilesCount == 1 ) { out.println("Here are a few files that may be corrupted:"); out.println("==========================================="); } out.println(currentPath); } } out.println(); out.println(buildSummaryResultForListCorruptFiles(matchedCorruptFilesCount, path)); }
private void checkEditExists(FSNamesystem fsn, int id) throws IOException { // Make sure the image loaded including our edit. assertNotNull(fsn.getFileInfo("/test" + id, false)); }
@Override // ClientProtocol public String getLinkTarget(String path) throws IOException { checkNNStartup(); metrics.incrGetLinkTargetOps(); HdfsFileStatus stat = null; try { stat = namesystem.getFileInfo(path, false); } catch (UnresolvedPathException e) { return e.getResolvedPath().toString(); } catch (UnresolvedLinkException e) { // The NameNode should only throw an UnresolvedPathException throw new AssertionError("UnresolvedLinkException thrown"); } if (stat == null) { throw new FileNotFoundException("File does not exist: " + path); } else if (!stat.isSymlink()) { throw new IOException("Path " + path + " is not a symbolic link"); } return stat.getSymlink(); }
@Override // ClientProtocol public String getLinkTarget(String path) throws IOException { checkNNStartup(); metrics.incrGetLinkTargetOps(); HdfsFileStatus stat = null; try { stat = namesystem.getFileInfo(path, false); } catch (UnresolvedPathException e) { return e.getResolvedPath().toString(); } catch (UnresolvedLinkException e) { // The NameNode should only throw an UnresolvedPathException throw new AssertionError("UnresolvedLinkException thrown"); } if (stat == null) { throw new FileNotFoundException("File does not exist: " + path); } else if (!stat.isSymlink()) { throw new IOException("Path " + path + " is not a symbolic link"); } return stat.getSymlink(); }
@Override public Boolean get() { LOG.info("Checking for " + src + " on BN"); try { boolean hasFile = backup.getNamesystem().getFileInfo(src, false) != null; boolean txnIdMatch = backup.getRpcServer().getTransactionID() == nn.getRpcServer().getTransactionID(); return hasFile && txnIdMatch; } catch (Exception e) { throw new RuntimeException(e); } } }, 30, 10000);
/** * Test case for loading a very simple edit log from a format * prior to the inclusion of edit transaction IDs in the log. */ @Test public void testPreTxidEditLogWithEdits() throws Exception { Configuration conf = new HdfsConfiguration(); MiniDFSCluster cluster = null; try { cluster = new MiniDFSCluster.Builder(conf).numDataNodes(0).build(); cluster.waitActive(); final FSNamesystem namesystem = cluster.getNamesystem(); long numEdits = testLoad(HADOOP20_SOME_EDITS, namesystem); assertEquals(3, numEdits); // Sanity check the edit HdfsFileStatus fileInfo = namesystem.getFileInfo("/myfile", false); assertEquals("supergroup", fileInfo.getGroup()); assertEquals(3, fileInfo.getReplication()); } finally { if (cluster != null) { cluster.shutdown(); } } }
assertNotNull(backup.getNamesystem().getFileInfo("/edit-while-bn-down", false)); } finally { LOG.info("Shutting down...");