long executeOp(int daemonId, int inputIdx, String ignore) throws IOException { long start = System.currentTimeMillis(); nameNode.getFileInfo(fileNames[daemonId][inputIdx]); long end = System.currentTimeMillis(); return end-start; } }
/** * {@inheritDoc} * * implement old API for backwards compatibility */ @Override @Deprecated public FileStatus[] getCorruptFiles() throws IOException { CorruptFileBlocks corruptFileBlocks = listCorruptFileBlocks("/", null); Set<String> filePaths = new HashSet<String>(); for (String file : corruptFileBlocks.getFiles()) { filePaths.add(file); } List<FileStatus> fileStatuses = new ArrayList<FileStatus>(filePaths.size()); for (String f: filePaths) { FileStatus fs = getFileInfo(f); if (fs != null) LOG.info("found fs for " + f); else LOG.info("found no fs for " + f); fileStatuses.add(fs); } return fileStatuses.toArray(new FileStatus[fileStatuses.size()]); }
@SuppressWarnings("deprecation") void generateInputs(int[] opsPerThread) throws IOException { // create files using opsPerThread String[] createArgs = new String[] { "-op", "create", "-threads", String.valueOf(this.numThreads), "-files", String.valueOf(numOpsRequired), "-filesPerDir", String.valueOf(nameGenerator.getFilesPerDirectory()), "-close"}; CreateFileStats opCreate = new CreateFileStats(Arrays.asList(createArgs)); if(!useExisting) { // create files if they were not created before opCreate.benchmark(); LOG.info("Created " + numOpsRequired + " files."); } else { LOG.info("useExisting = true. Assuming " + numOpsRequired + " files have been created before."); } // use the same files for open super.generateInputs(opsPerThread); if(nameNode.getFileInfo(opCreate.getBaseDir()) != null && nameNode.getFileInfo(getBaseDir()) == null) { nameNode.rename(opCreate.getBaseDir(), getBaseDir()); } if(nameNode.getFileInfo(getBaseDir()) == null) { throw new IOException(getBaseDir() + " does not exist."); } }
namenode.getNamesystem().mkdirs("/test", new PermissionStatus("hairong", null, FsPermission.getDefault()), true); assertTrue(namenode.getFileInfo("/test").isDir()); namenode.setSafeMode(SafeModeAction.SAFEMODE_ENTER); namenode.saveNamespace();
namenode.getNamesystem().mkdirs("/test", new PermissionStatus("hairong", null, FsPermission.getDefault()), true); assertTrue(namenode.getFileInfo("/test").isDir()); namenode.setSafeMode(SafeModeAction.SAFEMODE_ENTER); namenode.saveNamespace();
private void checkNameSpace(Configuration conf) throws IOException { NameNode namenode = new NameNode(conf); assertTrue(namenode.getFileInfo("/test").isDir()); namenode.setSafeMode(SafeModeAction.SAFEMODE_ENTER); namenode.saveNamespace(); namenode.stop(); namenode.join(); }
Path trgPath = new Path(trg); DFSTestUtil.createFile(dfs, trgPath, fileLen, REPL_FACTOR, 1); fStatus = nn.getFileInfo(trg); long trgLen = fStatus.getLen(); long trgBlocks = nn.getBlockLocations(trg, 0, trgLen).locatedBlockCount(); DFSTestUtil.createFile(dfs, path, fileLen, REPL_FACTOR, 1); fStatus = nn.getFileInfo(path.toUri().getPath()); lens[i] = fStatus.getLen(); fStatus = nn.getFileInfo(trg); fStatus = nn.getFileInfo(p.toUri().getPath()); assertNull("File " + p + " still exists", fStatus); // file shouldn't exist dfs.concat(trgPath, new Path [] {smallFile}); fStatus = nn.getFileInfo(trg);
DFSTestUtil.createFile(dfs, filePath1, trgFileLen, REPL_FACTOR, 1); HdfsFileStatus fStatus = cluster.getNameNode().getFileInfo(name1); long fileLen = fStatus.getLen(); assertEquals(fileLen, trgFileLen); fStatus = cluster.getNameNode().getFileInfo(name2); fileLen = fStatus.getLen(); assertEquals(srcFileLen, fileLen); fStatus = cluster.getNameNode().getFileInfo(name1); fileLen = fStatus.getLen(); fStatus = cluster.getNameNode().getFileInfo(name2); assertNull("File "+name2+ "still exists", fStatus); // file shouldn't exist