pg::wal::receive: make lsn_to_timeline public - #21
Merged
Conversation
serprex
reviewed
Jul 16, 2026
achudnovskij
force-pushed
the
expose-lsn-to-timeline
branch
2 times, most recently
from
July 16, 2026 22:26
fd0fda6 to
ea6a3d5
Compare
achudnovskij
marked this pull request as ready for review
July 16, 2026 22:26
External WAL-processing tools that stream replication (e.g. the wal-listener synchronous receiver) need to resolve which timeline owns a resume LSN by walking a `TIMELINE_HISTORY`
achudnovskij
force-pushed
the
expose-lsn-to-timeline
branch
from
July 16, 2026 22:40
ea6a3d5 to
da7ecab
Compare
serprex
approved these changes
Jul 17, 2026
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
Make the existing
lsn_to_timelineinpg::wal::receivepubso external WAL-processing tools can reuse it.Why
Resolving which timeline owns a resume LSN by walking a
TIMELINE_HISTORYresponse is a standard step for anything that streams replication and can resume behind a timeline fork.lsn_to_timelinealready implements it (mirrors wal-g'sLSNToTimeLine), but it was private, so the wal-listener synchronous receiver had to duplicate it byte-for-byte. This exposes the single implementation and lets that copy be deleted.Follow-up to #19 ("Expose replication + object-storage primitives for building WAL-processing tools").
Notes
fn→pub fn) plus a doc note.lsn_to_timeline_walks_historyunit test still covers it.pub mod pg→pub mod wal→pub mod receive), so it's reachable aswalrus::pg::wal::receive::lsn_to_timeline.🤖 Generated with Claude Code