Heartbeat in Postgres: Make pg_logical_emit_message transactional#3904
Open
Amogh-Bharadwaj wants to merge 1 commit intomainfrom
Open
Heartbeat in Postgres: Make pg_logical_emit_message transactional#3904Amogh-Bharadwaj wants to merge 1 commit intomainfrom
Amogh-Bharadwaj wants to merge 1 commit intomainfrom
Conversation
heavycrystal
approved these changes
Feb 9, 2026
❌ 2 Tests Failed:
View the top 2 failed test(s) by shortest run time
To view more test analytics, go to the Test Analytics Dashboard |
ilidemi
approved these changes
Feb 9, 2026
Contributor
ilidemi
left a comment
There was a problem hiding this comment.
Deferring to PG experts. Any risk of existing users being upset by xids incrementing more often?
Contributor
It's every 10 minutes, ~50K xids per year shouldn't be too bad. Needs to be seen if this will cause contention in other ways |
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.
We have noticed cases where in freshly spun up Postgres instances which have a replication slot and without having a single transaction performed on them by the user, our logical decoding messages emitted via the heartbeat workflow can cause WAL files to accumulate over time, taking up disk space, even though the slot size is low.
This is due to a Postgres issue where non-transactional changes in the WAL do not trigger recomputation of global required LSN across all slots. Thus this PR makes a change where it changes the first parameter in pg_emit_logical_message to true. The first parameter denotes whether the messages are transactional (i.e increment xid):
https://pgpedia.info/p/pg_logical_emit_message.html