Skip to content

fix: primary detection needs to account for timeline - #1738

Merged
levkk merged 1 commit into
mainfrom
levkk-add-timeline
Oct 6, 2026
Merged

levkk merged 1 commit into
mainfrom
levkk-add-timeline

Conversation

@levkk

@levkk levkk commented Oct 6, 2026 •

Copy link
Copy Markdown
Collaborator

Fix issue 1 in #1731.

Problem

Patroni brings the demoted primary online before rewinding it / disabling writes to it. This is a bug in Patroni (in my opinion), but we can still handle this.

Solution

Sort primary candidates by timeline and pick the one with the highest timeline number (pg_promote bumps timeline by 1).

Cleanup

  • Refactored the LSN query to use materialized CTEs for repeated admin functions.

@codecov

codecov Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

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