Search in sources :

Example 21 with NoopMaster

use of alluxio.master.NoopMaster in project SSM by Intel-bigdata.

the class AlluxioJournalUtil method getJournalReaderFromSn.

/**
 * @param conf smart configuration
 * @param startSn journal entry sequence number
 * @return journal reader
 */
public static JournalReader getJournalReaderFromSn(SmartConf conf, Long startSn) {
    UfsJournal journal = new UfsJournalSystem(getJournalLocation(conf), 0).createJournal(new NoopMaster(sMaster));
    JournalReader reader = new UfsJournalReader(journal, startSn, true);
    return reader;
}
Also used : NoopMaster(alluxio.master.NoopMaster) JournalReader(alluxio.master.journal.JournalReader)

Example 22 with NoopMaster

use of alluxio.master.NoopMaster in project SSM by Intel-bigdata.

the class AlluxioJournalUtil method getCurrentSeqNum.

/**
 * @param conf smart configuration
 * @return the current entry sequence number
 */
public static Long getCurrentSeqNum(SmartConf conf) {
    UfsJournal journal = new UfsJournalSystem(getJournalLocation(conf), 0).createJournal(new NoopMaster(sMaster));
    UfsJournalFile currentLog;
    try {
        currentLog = UfsJournalSnapshot.getCurrentLog(journal);
    } catch (IOException e) {
        throw new RuntimeException(e);
    }
    long sn = -1L;
    if (currentLog != null) {
        try (JournalReader reader = new UfsJournalReader(journal, currentLog.getStart(), true)) {
            Journal.JournalEntry entry;
            while ((entry = reader.read()) != null) {
                sn = entry.getSequenceNumber();
                if (sn >= Long.MAX_VALUE) {
                    break;
                }
            }
        } catch (Exception e) {
            LOG.error("Failed to read next journal entry.", e);
        }
    }
    return sn;
}
Also used : Journal(alluxio.proto.journal.Journal) IOException(java.io.IOException) URISyntaxException(java.net.URISyntaxException) IOException(java.io.IOException) NoopMaster(alluxio.master.NoopMaster) JournalReader(alluxio.master.journal.JournalReader)

Aggregations

NoopMaster (alluxio.master.NoopMaster)22 Test (org.junit.Test)12 JournalContext (alluxio.master.journal.JournalContext)9 URI (java.net.URI)9 UfsJournal (alluxio.master.journal.ufs.UfsJournal)6 Collections (java.util.Collections)5 HashMap (java.util.HashMap)5 AlluxioURI (alluxio.AlluxioURI)4 CatchupFuture (alluxio.master.journal.CatchupFuture)4 Before (org.junit.Before)4 JournalReader (alluxio.master.journal.JournalReader)3 Journal (alluxio.proto.journal.Journal)2 BaseIntegrationTest (alluxio.testutils.BaseIntegrationTest)2 IOException (java.io.IOException)2 ExpectedException (org.junit.rules.ExpectedException)2 PropertyKey (alluxio.conf.PropertyKey)1 NoopUfsManager (alluxio.master.NoopUfsManager)1 JournalSystem (alluxio.master.journal.JournalSystem)1 CheckpointInputStream (alluxio.master.journal.checkpoint.CheckpointInputStream)1 UfsJournalReader (alluxio.master.journal.ufs.UfsJournalReader)1