Search in sources :

Example 1 with ReinitializeFileEntry

use of alluxio.proto.journal.File.ReinitializeFileEntry in project alluxio by Alluxio.

the class FileSystemMaster method reinitializeFile.

/**
   * Reinitializes the blocks of an existing open file.
   *
   * @param path the path to the file
   * @param blockSizeBytes the new block size
   * @param ttl the ttl
   * @param ttlAction action to take after Ttl expiry
   * @return the file id
   * @throws InvalidPathException if the path is invalid
   * @throws FileDoesNotExistException if the path does not exist
   */
// Used by lineage master
public long reinitializeFile(AlluxioURI path, long blockSizeBytes, long ttl, TtlAction ttlAction) throws InvalidPathException, FileDoesNotExistException {
    try (JournalContext journalContext = createJournalContext();
        LockedInodePath inodePath = mInodeTree.lockFullInodePath(path, InodeTree.LockMode.WRITE)) {
        long id = mInodeTree.reinitializeFile(inodePath, blockSizeBytes, ttl, ttlAction);
        ReinitializeFileEntry reinitializeFile = ReinitializeFileEntry.newBuilder().setPath(path.getPath()).setBlockSizeBytes(blockSizeBytes).setTtl(ttl).setTtlAction(ProtobufUtils.toProtobuf(ttlAction)).build();
        appendJournalEntry(JournalEntry.newBuilder().setReinitializeFile(reinitializeFile).build(), journalContext);
        return id;
    }
}
Also used : LockedInodePath(alluxio.master.file.meta.LockedInodePath) ReinitializeFileEntry(alluxio.proto.journal.File.ReinitializeFileEntry)

Aggregations

LockedInodePath (alluxio.master.file.meta.LockedInodePath)1 ReinitializeFileEntry (alluxio.proto.journal.File.ReinitializeFileEntry)1