Skip to content

Conversation

@danolivo
Copy link
Contributor

…invalidation of newly created replication slots".

…invalidation of newly created replication slots".
@danolivo danolivo self-assigned this Feb 10, 2026
@danolivo danolivo added the bug Something isn't working label Feb 10, 2026
@coderabbitai
Copy link

coderabbitai bot commented Feb 10, 2026

📝 Walkthrough

Walkthrough

This patch enables logical decoding on PostgreSQL standby replicas by introducing standby-aware WAL level validation, two new functions for snapshot logging and WAL level retrieval, enhanced consistency checks during decoding context initialization, and adjustments to replication slot reservation and WAL timeline handling.

Changes

Cohort / File(s) Summary
Standby WAL Level Support
src/include/access/xlog.h, src/backend/access/transam/xlog.c
Added GetActiveWalLevelOnStandby() function to retrieve active WAL level from control file on standby replicas.
Standby Snapshot Functions
src/backend/access/transam/xlogfuncs.c, src/include/catalog/pg_proc.dat
Introduced pg_log_standby_snapshot() public function to log standby snapshots and return WAL pointer; registered in system catalog.
Logical Decoding Context Validation
src/backend/access/transam/xlog.c
Enhanced WAL level consistency checks in decoding context creation and logical decoding requirement validation to verify standby WAL level meets logical threshold.
Replication Slot & Timeline Handling
src/backend/access/transam/xlog.c
Refactored slot reservation logic to use standby-aware restart_lsn calculation; adjusted WAL timeline determination for cascading walsender and flush pointer usage on standby.
System Configuration
docs/..., system_functions.sql
Updated documentation and revoked execute privileges for new standby snapshot function.

Poem

A standby now whispers its tales to the stream,
With snapshots of logic in WAL's golden gleam,
No longer confined to the primary's throne,
The rabbit hops onward—decoding's been sown! 🐰✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title directly references a specific commit (aae05622a7c) and its purpose regarding replication slot invalidation prevention, which aligns with the PR's objective to arrange a patch to satisfy that commit.
Description check ✅ Passed The description clearly indicates this PR arranges patch 010 to satisfy the back-ported commit about preventing replication slot invalidation, which is directly related to the changeset.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch spoc-435-main

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
patches/15/pg15-010-allow_logical_decoding_on_standbys.diff (2)

18-19: ⚠️ Potential issue | 🟡 Minor

Minor grammar issue in documentation.

Line 19: "without having to wait bgwriter or checkpointer" is missing the preposition "for" — should read "without having to wait for bgwriter or checkpointer".


35-60: ⚠️ Potential issue | 🟡 Minor

Documentation markup inconsistency for hot_standby_feedback.

On line 38, hot_standby_feedback is correctly wrapped in <varname> tags, but on line 41 it appears as plain text. For consistency with SGML documentation conventions, it should also be wrapped in <varname> tags there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant