use of alluxio.master.journal.JournalWriter in project alluxio by Alluxio.
the class JournalIntegrationTest method multipleFlush.
/**
* Tests flushing the journal multiple times, without writing any data.
*/
@Test
public void multipleFlush() throws Exception {
// Set the max log size to 0 to force a flush to write a new file.
String existingMax = Configuration.get(PropertyKey.MASTER_JOURNAL_LOG_SIZE_BYTES_MAX);
Configuration.set(PropertyKey.MASTER_JOURNAL_LOG_SIZE_BYTES_MAX, "0");
try {
String journalFolder = mLocalAlluxioCluster.getMaster().getJournalFolder();
ReadWriteJournal journal = new ReadWriteJournal(PathUtils.concatPath(journalFolder, Constants.FILE_SYSTEM_MASTER_NAME));
JournalWriter writer = journal.getNewWriter();
writer.getCheckpointOutputStream(0).close();
// Flush multiple times, without writing to the log.
writer.flushEntryStream();
writer.flushEntryStream();
writer.flushEntryStream();
UnderFileStatus[] paths = UnderFileSystem.Factory.get(journalFolder).listStatus(journal.getCompletedDirectory());
// Make sure no new empty files were created.
Assert.assertTrue(paths == null || paths.length == 0);
} finally {
// Reset the max log size.
Configuration.set(PropertyKey.MASTER_JOURNAL_LOG_SIZE_BYTES_MAX, existingMax);
}
}
Aggregations