Skip to content

fix: exclude replayed WAL rows after rollout writer restart - #305

Merged
beinan merged 1 commit into
mainfrom
codex/rollout-append-replay-epoch
Oct 4, 2026
Merged

beinan merged 1 commit into
mainfrom
codex/rollout-append-replay-epoch

Conversation

@beinan

@beinan beinan commented Oct 4, 2026 •

Copy link
Copy Markdown
Collaborator

A worker restart can replay an already-published WAL tail into a new generation when the replay cursor lagged the flush. Azure staging exposed this after a successful parallel merge and worker replacement: the next append produced 516 base rows for 512 unique IDs. Generation watermarks and the one-time migration cutoff cannot recognize the replay under its new generation number.

Persist the observed writer epoch per shard and extend the bounded ID-check cutoff when that epoch changes. Include the active generation, so planning between epoch claim and replay flush remains safe. Keep the cutoff fixed within an epoch so steady-state appends retain the lookup-free path. Existing metadata without an epoch gets one conservative transition check; malformed or regressing epoch metadata fails closed.

The regression explicitly leaves a lagging replay cursor, reopens the same shard, plans before the recovered memtable flushes, and checks that only the new row is appended. It also verifies subsequent generations in that epoch return to the fast path.

Validation: the deterministic replay regression passes, and all ten rollout-append regression tests pass (one opt-in benchmark ignored), including commit-before-drain recovery, legacy fallback watermarks, schema/version checks and revoked-owner publication. All ten CI checks passed, including full Rust tests, etcd-backed HA tests, coverage, clippy, Python tests and three-platform wheel builds. The fixed image is still being built for the Azure repetition before production rollout. Production parallel activation remains off; no further ordinary-worker replacements will occur before validation completes.

@beinan
beinan marked this pull request as ready for review October 4, 2026 18:45
@beinan
beinan merged commit 554c3eb into main Oct 4, 2026
10 checks passed
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