Search in sources :

Example 1 with DeleteMountPointEntry

use of alluxio.proto.journal.File.DeleteMountPointEntry 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);
    }
}
Also used : DeleteFileEntry(alluxio.proto.journal.File.DeleteFileEntry) DeleteMountPointEntry(alluxio.proto.journal.File.DeleteMountPointEntry)

Aggregations

DeleteFileEntry (alluxio.proto.journal.File.DeleteFileEntry)1 DeleteMountPointEntry (alluxio.proto.journal.File.DeleteMountPointEntry)1