Search in sources :

Example 1 with UfsJournalSnapshot

use of alluxio.master.journal.ufs.UfsJournalSnapshot in project alluxio by Alluxio.

the class IntegrationTestUtils method waitForUfsJournalCheckpoint.

/**
 * Waits for a checkpoint to be written in the specified master's journal.
 *
 * @param masterName the name of the master
 * @param journalLocation the location of the journal
 */
public static void waitForUfsJournalCheckpoint(String masterName, URI journalLocation) throws TimeoutException, InterruptedException {
    UfsJournal journal = new UfsJournal(URIUtils.appendPathOrDie(journalLocation, masterName), new NoopMaster(""), 0, Collections::emptySet);
    CommonUtils.waitFor("checkpoint to be written", () -> {
        UfsJournalSnapshot snapshot;
        try {
            snapshot = UfsJournalSnapshot.getSnapshot(journal);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
        return !snapshot.getCheckpoints().isEmpty();
    });
}
Also used : IOException(java.io.IOException) Collections(java.util.Collections) UfsJournal(alluxio.master.journal.ufs.UfsJournal) NoopMaster(alluxio.master.NoopMaster) UfsJournalSnapshot(alluxio.master.journal.ufs.UfsJournalSnapshot)

Aggregations

NoopMaster (alluxio.master.NoopMaster)1 UfsJournal (alluxio.master.journal.ufs.UfsJournal)1 UfsJournalSnapshot (alluxio.master.journal.ufs.UfsJournalSnapshot)1 IOException (java.io.IOException)1 Collections (java.util.Collections)1