Conversation
A reader that pages with a fresh snapshot per page can land between two producer transactions and return a half-applied batch, with no token to tell a complete page from an incomplete one. SHOW SNAPSHOT returns the monotonic WAL sequence at the moment of the call, with the node id and the build version. Capture the pin once, and a producer that records the same pin in its commit marker lets the reader decide whether the batch it paged is complete. Not tenant-admin gated: it exposes no tenant data, and a reader needs the pin before it has paged anything.
EnRaiha
force-pushed
the
pr/374-370-show-snapshot
branch
from
October 2, 2026 07:24
d1f707e to
62e8f4a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
SHOW SNAPSHOTreturns the read pin a multi-page reader needs.A reader that pages with a fresh snapshot per page can land between two producer transactions and return a half-applied batch. It had no token to tell a complete page from an incomplete one, so a loader paging a 66k edge backfill could not detect a torn read and would act on partial data.
It returns the monotonic WAL sequence at the moment of the call, with the node id and the build version. The reason the pin is the sequence and not a timestamp is that a sequence orders writes, while a clock does not. Capture the pin once; a producer that records the same pin in its commit marker lets the reader decide whether the batch it paged is complete.
Not tenant-admin gated: it exposes no tenant data, and a reader needs the pin before it has paged anything.
Evidence
The test fails on
mainwithout this change. Proof: the test was copied onto a cleanorigin/main(bd8da7dc2) worktree and run there first.cargo nextest run -p nodedb --test wire -E 'test(~show_snapshot_returns_the_wal_pin)'on a cleanmain: FAIL.pgwire_show_dispatch19/19 pass, includingshow_snapshot_returns_the_wal_pin.snapshot_pinnames the pin kind, and thatwal_next_lsnparses as a decimal integer and does not regress across a write.cargo check -p nodedb,cargo fmt --all -- --check, and a lib clippy run are clean.show_snapshot_returns_the_wal_pinfails; restored, it passes.What CI does not cover locally
Closes #370