@ThreadSafe protected static class UfsJournalWriter.EntryOutputStream extends Object implements JournalOutputStream
1. The log size reachesmMaxLogSize
2.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 |
---|
EntryOutputStream(UnderFileSystem ufs,
URI log,
JournalFormatter journalFormatter,
UfsJournalWriter journalWriter) |
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the stream.
|
void |
flush()
Flushes the stream.
|
void |
write(Journal.JournalEntry entry)
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 journallog
- the location to write the log tojournalFormatter
- the journal formatter to use when writing journal entriesjournalWriter
- the journal writer to use to get journal entry sequence numbers and
complete the log when it needs to be rotatedIOException
public void write(Journal.JournalEntry entry) throws IOException
write
in interface JournalOutputStream
entry
- an entry to write to the journal checkpoint fileIOException
public void close() throws IOException
JournalOutputStream
close
in interface JournalOutputStream
close
in interface AutoCloseable
IOException
public void flush() throws IOException
JournalOutputStream
flush
in interface JournalOutputStream
IOException
Copyright © 2023. All Rights Reserved.