Add snapshot completeness validation - #65
Conversation
- Implement validation to ensure snapshots contain all expected pages - Track lastPgno during page decoding - Add comprehensive tests for snapshot completeness validation - Handle special case where commit equals lock page number - Resolves TODO: Ensure last read page is equal to the commit for snapshot LTX files
44b7380 to
8c65988
Compare
|
Reviewed this while clearing the older PRs. It's still correct against current The completeness check is skipped entirely for a snapshot with no pages at all. if dec.header.IsSnapshot() && dec.lastPgno != 0 {
So truncation is caught, total absence is not. The if dec.header.IsSnapshot() {I applied exactly that on the branch and re-ran: One thing to consider beyond the fix. Checking only the last page number means a file with a gap in the middle — pages 1 and 3 with Base is old. This branch sits on d017048 and predates #89, #90, #91 and #92. GitHub still reports it mergeable and it tests clean, but it's worth rebasing before merge so CI runs against what's actually on Also worth noting this implements the |
Summary
Changes
decoder.goto track the last page number read and validate it matches the expected value for snapshotsTestDecoder_SnapshotCompletenesswith four test cases:Implementation Details
The decoder now tracks
lastPgnoduring page reads and validates duringClose()that:This ensures snapshot files are complete and haven't been truncated or corrupted.
🤖 Generated with Claude Code