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;
}
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;
}
Aggregations