private long removeFile(Path path) { try { if (!useTrash || !fs.moveToTrash(path)) { fs.deleteRecursively(path); } return 1; } catch (FileNotFoundException ex) { // ignored } catch (IOException ex) { log.error("Unable to delete wal {}", path, ex); } return 0; }
/** * Moves a file to trash. If this garbage collector is not using trash, this method returns false * and leaves the file alone. If the file is missing, this method returns false as opposed to * throwing an exception. * * @return true if the file was moved to trash * @throws IOException * if the volume manager encountered a problem */ boolean moveToTrash(Path path) throws IOException { if (!isUsingTrash()) return false; try { return fs.moveToTrash(path); } catch (FileNotFoundException ex) { return false; } }
public static void finishReplacement(AccumuloConfiguration acuTableConf, VolumeManager fs, Path location, Set<FileRef> oldDatafiles, String compactName) throws IOException { // start deleting files, if we do not finish they will be cleaned // up later for (FileRef ref : oldDatafiles) { Path path = ref.path(); Path deleteFile = new Path(location + "/delete+" + compactName + "+" + path.getName()); if (acuTableConf.getBoolean(Property.GC_TRASH_IGNORE) || !fs.moveToTrash(deleteFile)) fs.deleteRecursively(deleteFile); } }
private long removeFile(Path path) { try { if (!useTrash || !fs.moveToTrash(path)) { fs.deleteRecursively(path); } return 1; } catch (FileNotFoundException ex) { log.debug("Attempted to delete WAL {} that did not exists : {}", path, ex.getMessage()); } catch (IOException ex) { log.error("Unable to delete wal {}", path, ex); } return 0; }
public static void finishReplacement(AccumuloConfiguration acuTableConf, VolumeManager fs, Path location, Set<FileRef> oldDatafiles, String compactName) throws IOException { // start deleting files, if we do not finish they will be cleaned // up later for (FileRef ref : oldDatafiles) { Path path = ref.path(); Path deleteFile = new Path(location + "/delete+" + compactName + "+" + path.getName()); if (acuTableConf.getBoolean(Property.GC_TRASH_IGNORE) || !fs.moveToTrash(deleteFile)) fs.deleteRecursively(deleteFile); } }
/** * Moves a file to trash. If this garbage collector is not using trash, this method returns false * and leaves the file alone. If the file is missing, this method returns false as opposed to * throwing an exception. * * @return true if the file was moved to trash * @throws IOException * if the volume manager encountered a problem */ boolean archiveOrMoveToTrash(Path path) throws IOException { if (shouldArchiveFiles()) { return archiveFile(path); } else { if (!isUsingTrash()) return false; try { return fs.moveToTrash(path); } catch (FileNotFoundException ex) { return false; } } }