Skip to content

Adding the ability to read from a parent WAL and write to a new WAL - #6

Merged
udnay merged 5 commits into
yo/relax-wal-uri-checkfrom
yo/add-read-only-wal-write-wal
Apr 7, 2026
Merged

Adding the ability to read from a parent WAL and write to a new WAL#6
udnay merged 5 commits into
yo/relax-wal-uri-checkfrom
yo/add-read-only-wal-write-wal

Conversation

@udnay

@udnay udnay commented Apr 3, 2026

Copy link
Copy Markdown

Adding the ability to read from a parent WAL and write to a new WAL

Adding the ability to read from a parent WAL and write to a new WAL

Summary

What is being changed and why?

Changes

Notes for Reviewers

Any hints on how to best review this PR? Anything you’d like reviewers to focus on? Any follow-ups planned?

Checklist

  • Small, scoped PR (< 500 total lines excluding tests); or opened as Draft with a plan on how to break it into smaller pieces
  • Linked related issue(s) or added context in the description
  • Self-reviewed the diff; added comments for tricky parts
  • Tests added/updated and passing locally
  • Ran cargo fmt, cargo clippy --all-targets --all-features, and cargo nextest run --all-features
  • Called out any breaking changes and provided migration notes
  • Considered performance impact; added notes or benchmarks if relevant

Thank you for the review! 🙏

@udnay

udnay commented Apr 3, 2026

Copy link
Copy Markdown
Author

udnay added 2 commits April 6, 2026 15:56
before cloning, `copy_wal_ssts` would fail with `NotFound` trying to copy
WAL SSTs that no longer exist (but whose data is safely in L0).

`copy_wal_ssts` now skips `NotFound` WAL SSTs at the start of the copy
range (these are WALs already flushed to L0) and returns an adjusted
`replay_after_wal_id` so the clone manifest doesn't reference them.
Missing WALs after a successfully copied WAL still error, since that
indicates actual data loss rather than post-flush cleanup.
…ed-up WAL files

When a DB opens, fence_writers writes an empty WAL SST that advances
next_wal_sst_id but not replay_after_wal_id, leaving a gap of 1. After
a full flush the memtable is empty, so flush_memtables never freezes or
flushes anything, and replay_after_wal_id stays behind. If the WAL store
is later cleaned up externally (e.g. local disk wiped after a shard
split), a clone created from this checkpoint tries to copy the missing
fencing WAL and crashes with NotFound.

Fix: after CheckpointScope::All flushes complete, advance
replay_after_wal_id to next_wal_sst_id - 1. All data is already in L0
at that point, so the remaining WAL SSTs are redundant.
@udnay
udnay force-pushed the yo/add-read-only-wal-write-wal branch from fc41306 to fcc8a7e Compare April 6, 2026 21:28
@udnay
udnay merged commit 8bc2754 into yo/relax-wal-uri-check Apr 7, 2026
13 of 14 checks passed
@udnay
udnay deleted the yo/add-read-only-wal-write-wal branch April 7, 2026 01:16
udnay added a commit that referenced this pull request Apr 7, 2026
Adding the ability to read from a parent WAL and write to a new WAL
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.

1 participant