use of alluxio.master.journal.ufs.UfsJournalSystem in project alluxio by Alluxio.
the class UfsJournalDumper method dumpJournal.
@Override
public void dumpJournal() throws Throwable {
try (UfsJournal journal = new UfsJournalSystem(getJournalLocation(mInputDir), 0).createJournal(new NoopMaster(mMaster));
PrintStream out = new PrintStream(new BufferedOutputStream(new FileOutputStream(mJournalEntryFile)));
JournalReader reader = new UfsJournalReader(journal, mStart, true)) {
boolean done = false;
while (!done && reader.getNextSequenceNumber() < mEnd) {
JournalReader.State state = reader.advance();
switch(state) {
case CHECKPOINT:
try (CheckpointInputStream checkpoint = reader.getCheckpoint()) {
Path dir = Paths.get(mCheckpointsDir + "-" + reader.getNextSequenceNumber());
Files.createDirectories(dir);
readCheckpoint(checkpoint, dir);
}
break;
case LOG:
Journal.JournalEntry entry = reader.getEntry();
out.println(ENTRY_SEPARATOR);
out.print(entry);
break;
case DONE:
done = true;
break;
default:
throw new RuntimeException("Unknown state: " + state);
}
}
}
}
Aggregations