Skip to content

Snapshot load must not drop a durable tail - #13

Merged
jaredLunde merged 3 commits into
beyondoss:mainfrom
paulocsanz:dst/snapshot-crash-bitrot
Aug 14, 2026
Merged

Snapshot load must not drop a durable tail#13
jaredLunde merged 3 commits into
beyondoss:mainfrom
paulocsanz:dst/snapshot-crash-bitrot

Conversation

@paulocsanz

Copy link
Copy Markdown
Contributor

A mid-file length flip, a torn first record, or trailing NULs could lose checkpointed keys or reject a good prefix. Two commits: tests that fail on main, then the fix.

  • Cap untrusted value_len before treating it as EOF (bitrot used to silent-drop later records).
  • Rewrite a junk first record so a later apply is visible on reopen.
  • Treat all-zero slack as a discarded tail, not InvalidFormat.

git checkout HEAD~1 && cargo test --test dst_invariants fails; HEAD passes.

Length-before-CRC silent tail, torn first record + apply loss, and trailing zeros rejecting the prefix. These fail on current main.
Cap untrusted value_len before treating it as EOF, rewrite a junk first record so later apply is visible, and treat all-zero slack as a discarded tail instead of InvalidFormat.
@jaredLunde
jaredLunde merged commit e6f13f1 into beyondoss:main Aug 14, 2026
1 check passed
@jaredLunde jaredLunde mentioned this pull request Aug 16, 2026
jaredLunde added a commit that referenced this pull request Aug 16, 2026
* chore: bump to 0.7.3 — durability fixes since 0.7.2

Ship the four post-0.7.2 snapshot/watch fixes to crates.io:
- #13 snapshot load must not drop a durable tail
- #14 fsync parent directory after compact rename
- #15 refuse watch resume at u64::MAX (no wrap to 0)
- #16 mid-file NULs must not drop a CRC-valid suffix

Also refresh README install snippets from 0.5 → 0.7.

Co-authored-by: Jared Lunde <jared.lunde@gmail.com>

* chore: sync Cargo.lock package version to 0.7.3

Co-authored-by: Jared Lunde <jared.lunde@gmail.com>

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants