use of alluxio.proto.journal.File.DeleteFileEntry in project alluxio by Alluxio.
the class FileSystemMaster method unmountAndJournal.
/**
* Unmounts a UFS path previously mounted onto an Alluxio path.
* <p>
* Writes to the journal.
*
* @param inodePath the Alluxio path to unmount, must be a mount point
* @param journalContext the journal context
* @throws InvalidPathException if an invalid path is encountered
* @throws FileDoesNotExistException if the path to be mounted does not exist
* @throws IOException if an I/O error occurs
*/
private void unmountAndJournal(LockedInodePath inodePath, JournalContext journalContext) throws InvalidPathException, FileDoesNotExistException, IOException {
if (unmountInternal(inodePath.getUri())) {
Inode<?> inode = inodePath.getInode();
// Use the internal delete API, setting {@code replayed} to true to prevent the delete
// operations from being persisted in the UFS.
long fileId = inode.getId();
long opTimeMs = System.currentTimeMillis();
deleteRecursiveInternal(inodePath, true, /* replayed */
opTimeMs, DeleteOptions.defaults().setRecursive(true));
DeleteFileEntry deleteFile = DeleteFileEntry.newBuilder().setId(fileId).setRecursive(true).setOpTimeMs(opTimeMs).build();
appendJournalEntry(JournalEntry.newBuilder().setDeleteFile(deleteFile).build(), journalContext);
DeleteMountPointEntry deleteMountPoint = DeleteMountPointEntry.newBuilder().setAlluxioPath(inodePath.getUri().toString()).build();
appendJournalEntry(JournalEntry.newBuilder().setDeleteMountPoint(deleteMountPoint).build(), journalContext);
}
}
use of alluxio.proto.journal.File.DeleteFileEntry in project alluxio by Alluxio.
the class FileSystemMaster method deleteAndJournal.
/**
* Deletes a given path.
* <p>
* Writes to the journal.
*
* @param inodePath the path to delete
* @param deleteOptions the method options
* @param journalContext the journal context
* @throws InvalidPathException if the path is invalid
* @throws FileDoesNotExistException if the file does not exist
* @throws IOException if an I/O error occurs
* @throws DirectoryNotEmptyException if recursive is false and the file is a nonempty directory
*/
private void deleteAndJournal(LockedInodePath inodePath, DeleteOptions deleteOptions, JournalContext journalContext) throws InvalidPathException, FileDoesNotExistException, IOException, DirectoryNotEmptyException {
Inode<?> inode = inodePath.getInode();
long fileId = inode.getId();
long opTimeMs = System.currentTimeMillis();
deleteInternal(inodePath, false, opTimeMs, deleteOptions);
DeleteFileEntry deleteFile = DeleteFileEntry.newBuilder().setId(fileId).setRecursive(deleteOptions.isRecursive()).setOpTimeMs(opTimeMs).build();
appendJournalEntry(JournalEntry.newBuilder().setDeleteFile(deleteFile).build(), journalContext);
}
Aggregations