pub struct LastFileReader<F: LogFileAccess> { /* private fields */ }Expand description
Tracks the last occurrence of specific log entry types.
Used during recovery to find checkpoint entries, etc.
Implementations§
Source§impl<F: LogFileAccess> LastFileReader<F>
impl<F: LogFileAccess> LastFileReader<F>
Sourcepub fn new(file_access: F, read_buffer_size: usize) -> Result<Self>
pub fn new(file_access: F, read_buffer_size: usize) -> Result<Self>
Create a LastFileReader.
Automatically positions at the last good file with a complete header.
§Arguments
file_access- File I/O interfaceread_buffer_size- Size of read buffer
Sourcepub fn set_target_type(&mut self, entry_type: u8)
pub fn set_target_type(&mut self, entry_type: u8)
Register an entry type to track.
When entries of this type are encountered, their LSN will be recorded.
Sourcepub fn set_halt_on_commit_after_checksum(&mut self, halt: bool)
pub fn set_halt_on_commit_after_checksum(&mut self, halt: bool)
Enable/disable halt-on-committed-txn-after-checksum behavior.
Recovery wires this from the config param
noxu.haltOnCommitAfterChecksumException
(HALT_ON_COMMIT_AFTER_CHECKSUMEXCEPTION). When enabled, a checksum
failure during end-of-log discovery triggers a forward scan for a
TxnCommit entry; if one is found, read_next_entry returns the
fatal NoxuLogError::FoundCommittedTxn rather than silently
truncating.
Faithful to JE LastFileReader.readNextEntry (LastFileReader.java:313).
Sourcepub fn get_last_seen(&self, entry_type: u8) -> Lsn
pub fn get_last_seen(&self, entry_type: u8) -> Lsn
Get the last LSN seen for a tracked entry type.
Returns NULL_LSN if the type was not seen.
Sourcepub fn get_end_of_log(&self) -> Lsn
pub fn get_end_of_log(&self) -> Lsn
Get the end-of-log LSN.
This is the LSN to use for the next log entry.
Sourcepub fn get_last_valid_lsn(&self) -> Lsn
pub fn get_last_valid_lsn(&self) -> Lsn
Get the last valid LSN.
This is the LSN of the last successfully validated entry.
Sourcepub fn get_prev_offset(&self) -> u64
pub fn get_prev_offset(&self) -> u64
Get the previous offset from the last entry.
Sourcepub fn get_entry_type(&self) -> u8
pub fn get_entry_type(&self) -> u8
Get the type of the last entry processed.
Sourcepub fn read_next_entry(&mut self) -> Result<bool>
pub fn read_next_entry(&mut self) -> Result<bool>
Read the next entry.
This method stops at bad entries (checksum failures) and reports them as the end of the log, rather than throwing an error.
Returns Ok(true) if an entry was read, Ok(false) at end.