@ThreadSafe protected static class UfsJournalWriter.EntryOutputStream extends Object implements JournalOutputStream
1. The log size reaches
flush()is called but the journal is in a UFS which doesn't support flush. Closing the file is the only way to simulate a flush. 3. An IO exception occurs while writing to or flushing an entry. We must rotate here in case corrupted data was written. When reading the log we will detect corruption and assume that it's at the end of the log.
|Constructor and Description|
|Modifier and Type||Method and Description|
Closes the stream.
Flushes the stream.
The given entry should not have its sequence number set.
public EntryOutputStream(UnderFileSystem ufs, URI log, JournalFormatter journalFormatter, UfsJournalWriter journalWriter) throws IOException
ufs- the under storage holding the journal
log- the location to write the log to
journalFormatter- the journal formatter to use when writing journal entries
journalWriter- the journal writer to use to get journal entry sequence numbers and complete the log when it needs to be rotated
public void write(Journal.JournalEntry entry) throws IOException
public void close() throws IOException
Copyright © 2021. All Rights Reserved.