Expand description
Check and repair a damaged engine journal. Engine::open refuses a journal
with any bad record; these functions apply the same rules to report the
longest prefix that still replays, and to rebuild a journal from it or from
an intact copy. See docs/ENGINE-RECOVERY.md for what each step can and
cannot get back.
Structs§
- Journal
Check - What
Engine::openwould make of a journal. - Journal
Damage - The first record that does not replay, and why.
- Journal
Recovery - The journal a repair keeps, and where it came from.
- Journal
Repair - Outcome of
repair_journal_file.
Functions§
- check_
journal - Replay
entrieswith the checksum, format, revision, allocator and selected constraint rules ofEngine::open. Never fails: damage is part of the report. Costs the same O(N) replay as opening, without a log. - read_
journal_ file_ lossy - Complete lines of a file journal, in the form
FileTransitionLogreads them, but tolerating damage it would reject: invalid UTF-8 becomes U+FFFD (so the checksum flags that record) and a missing file is empty. - recover_
journal - Pick the longest valid prefix among copies of one journal: the damaged primary first, then replicas, mirrors or a restored backup. Every other copy’s valid prefix must be a prefix of the chosen one. Copies that disagree are refused rather than guessed between, because each may hold commits the other lacks; choose one explicitly. A copy compacted into an engine3 checkpoint disagrees with an uncompacted copy of the same history.
- repair_
journal_ file - Rebuild the journal at
pathfrom the longest valid prefix among it andcopies(seerecover_journal). The original bytes are first copied to<path>.damaged-<n>; the replacement is flushed, then renamed overpath. Holds the writer lock thatFileTransitionLog::open_exclusivetakes, so it fails while an engine owns the journal. Copies are only read; their owners must not be writing them.