Search in sources :

Example 26 with JournalContext

use of alluxio.master.journal.JournalContext in project alluxio by Alluxio.

the class AccessTimeUpdater method flushUpdates.

private void flushUpdates() {
    try (JournalContext context = mFileSystemMaster.createJournalContext()) {
        for (Iterator<Map.Entry<Long, Long>> iterator = mAccessTimeUpdates.entrySet().iterator(); iterator.hasNext(); ) {
            Map.Entry<Long, Long> inodeEntry = iterator.next();
            iterator.remove();
            UpdateInodeEntry entry = UpdateInodeEntry.newBuilder().setId(inodeEntry.getKey()).setLastAccessTimeMs(inodeEntry.getValue()).build();
            context.append(Journal.JournalEntry.newBuilder().setUpdateInode(entry).build());
        }
    } catch (UnavailableException e) {
        LOG.debug("Failed to flush access time updates.", e);
    }
}
Also used : UpdateInodeEntry(alluxio.proto.journal.File.UpdateInodeEntry) UpdateInodeEntry(alluxio.proto.journal.File.UpdateInodeEntry) JournalContext(alluxio.master.journal.JournalContext) UnavailableException(alluxio.exception.status.UnavailableException) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) Map(java.util.Map)

Aggregations

JournalContext (alluxio.master.journal.JournalContext)26 Test (org.junit.Test)15 AlluxioURI (alluxio.AlluxioURI)9 NoopMaster (alluxio.master.NoopMaster)9 HashMap (java.util.HashMap)8 LockedInodePath (alluxio.master.file.meta.LockedInodePath)6 NoopJournalContext (alluxio.master.journal.NoopJournalContext)5 Journal (alluxio.proto.journal.Journal)5 CatchupFuture (alluxio.master.journal.CatchupFuture)4 LockResource (alluxio.resource.LockResource)4 MountInfo (alluxio.master.file.meta.options.MountInfo)3 ExpectedException (org.junit.rules.ExpectedException)3 FileDoesNotExistException (alluxio.exception.FileDoesNotExistException)2 InvalidPathException (alluxio.exception.InvalidPathException)2 NotFoundException (alluxio.exception.status.NotFoundException)2 UnavailableException (alluxio.exception.status.UnavailableException)2 MountPOptions (alluxio.grpc.MountPOptions)2 HeartbeatThread (alluxio.heartbeat.HeartbeatThread)2 MasterWorkerInfo (alluxio.master.block.meta.MasterWorkerInfo)2 Inode (alluxio.master.file.meta.Inode)2