if (!this.util().exists(f)) { return false;
protected void finalize(int partNum) throws IOException { String tmpToFinalize = fileSystemWAL.tempPartFiles.remove(partNum); Path tmpPath = new Path(tmpToFinalize); if (fileSystemWAL.fileContext.util().exists(tmpPath)) { LOG.debug("finalize {} of part {}", tmpPath, partNum); fileSystemWAL.fileContext.rename(tmpPath, new Path(fileSystemWAL.getPartFilePath(partNum)), Options.Rename.OVERWRITE); latestFinalizedPart = partNum; } }
protected void createReadOnlyWals() throws IOException { Path statePath = new Path(fullStatePath); if (fileContext.util().exists(statePath)) { RemoteIterator<FileStatus> operatorsIter = fileContext.listStatus(statePath); while (operatorsIter.hasNext()) { FileStatus status = operatorsIter.next(); int operatorId = Integer.parseInt(status.getPath().getName()); if (operatorId != this.operatorId) { //create read-only wal for other partitions FSWindowReplayWAL wal = new FSWindowReplayWAL(true); readOnlyWals.put(operatorId, wal); } } } }
public static boolean exists(FileContext fc, Path p) throws IOException { return fc.util().exists(p); }
private boolean ifExists(Path path) throws IOException { return useFCOption ? mfc.util().exists(path) : mfs.exists(path); }
public boolean exists(Path p) throws IOException { return fc.util().exists(p); }
@Override public boolean exists() throws IOException { return fc.util().exists(path); }
@Test public void testFcCopy() throws Exception{ final String ts = "some random text"; Path file1 = getTestRootPath(fc, "file1"); Path file2 = getTestRootPath(fc, "file2"); writeFile(fc, file1, ts.getBytes()); assertTrue(fc.util().exists(file1)); fc.util().copy(file1, file2); // verify that newly copied file2 exists assertTrue("Failed to copy file2 ", fc.util().exists(file2)); // verify that file2 contains test string assertTrue("Copied files does not match ",Arrays.equals(ts.getBytes(), readFile(fc,file2,ts.getBytes().length))); }
public static boolean exists(FileContext fc, Path p) throws IOException { return fc.util().exists(p); }
public static boolean exists(FileContext fc, Path p) throws IOException { return fc.util().exists(p); }
@Test public void testFcCopy() throws Exception{ final String ts = "some random text"; Path file1 = fileContextTestHelper.getTestRootPath(fc, "file1"); Path file2 = fileContextTestHelper.getTestRootPath(fc, "file2"); writeFile(fc, file1, ts.getBytes()); assertTrue(fc.util().exists(file1)); fc.util().copy(file1, file2); // verify that newly copied file2 exists assertTrue("Failed to copy file2 ", fc.util().exists(file2)); // verify that file2 contains test string assertTrue("Copied files does not match ",Arrays.equals(ts.getBytes(), readFile(fc,file2,ts.getBytes().length))); }
@Test public void testFcCopy() throws Exception{ final String ts = "some random text"; Path file1 = fileContextTestHelper.getTestRootPath(fc, "file1"); Path file2 = fileContextTestHelper.getTestRootPath(fc, "file2"); writeFile(fc, file1, ts.getBytes()); assertTrue(fc.util().exists(file1)); fc.util().copy(file1, file2); // verify that newly copied file2 exists assertTrue("Failed to copy file2 ", fc.util().exists(file2)); // verify that file2 contains test string assertTrue("Copied files does not match ",Arrays.equals(ts.getBytes(), readFile(fc,file2,ts.getBytes().length))); }
@Override public boolean exists() throws IOException { return fc.util().exists(path); }
public boolean exists(Path p) throws IOException { return fc.util().exists(p); }
private boolean checkDirectoryExists(FileContext fileContext, org.apache.hadoop.fs.Path path) throws IOException { if (fileContext.util().exists(path)) { // dir exists // check permissions FsAction action = fileContext.getFileStatus(path).getPermission().getOtherAction(); if (!action.implies(FsAction.WRITE)) { LOG.error("Directory {} is not writable for others, If you are using secure impersonation, " + "make this directory writable for others, else you can ignore this message.", path); } return true; } return false; }
private void findFiles(FSWindowReplayWAL wal, int operatorId) throws IOException { String operatorDir = fullStatePath + Path.SEPARATOR + operatorId; Path operatorPath = new Path(operatorDir); if (fileContext.util().exists(operatorPath)) { RemoteIterator<FileStatus> walFilesIter = fileContext.listStatus(operatorPath); while (walFilesIter.hasNext()) { FileStatus fileStatus = walFilesIter.next(); FSWindowReplayWAL.FileDescriptor descriptor = FSWindowReplayWAL.FileDescriptor.create(fileStatus.getPath()); wal.fileDescriptors.put(descriptor.part, descriptor); } } }
private void cleanupLogDir(FileContext fs, DeletionService del, String logDir) throws IOException { if (!fs.util().exists(new Path(logDir))){ return; } renameAppLogDir(logDir); deleteAppLogDir(fs, del, logDir); }
private void cleanupLogDir(FileContext fs, DeletionService del, String logDir) throws IOException { if (!fs.util().exists(new Path(logDir))){ return; } renameAppLogDir(logDir); deleteAppLogDir(fs, del, logDir); }
@Override public Void run() throws Exception { if (fileContext.util().exists(deletePath)) { fileContext.delete(deletePath, false); } return null; } }.runWithRetries();
@Override public Object run() throws Exception { if (fileContext.util().exists(fileToDelete)) { fileContext.delete(fileToDelete, false); } return null; } });