Support replication origin advance for xid-less commits#54
Draft
GremSnoort wants to merge 1 commit intopatches17from
Draft
Support replication origin advance for xid-less commits#54GremSnoort wants to merge 1 commit intopatches17from
GremSnoort wants to merge 1 commit intopatches17from
Conversation
Add a transaction-level hook that lets an extension provide a durable local commit LSN for a top-level transaction that reaches commit without a heap XID. Use that LSN in RecordTransactionCommit() to advance replication origin from the no-XID path, and propagate it through the rest of the commit tail for flush, async commit tracking, synchronous replication wait, and XactLastCommitEnd. This keeps commit/origin policy in core PostgreSQL while allowing storage engines with xid-less commit paths to participate through a narrow hook.
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.
Summary
This patch adds a transaction-level integration point to PostgreSQL commit machinery to support correct replication origin advancement for top-level transactions that reach commit without a heap XID but still have a durable local commit LSN.
The immediate motivation is fixing logical replication failures observed with storage engines that use a non-heap-XID commit model, such as OrioleDB.
Problem
PostgreSQL currently assumes the following model:
That assumption is too narrow for storage engines that can:
OrioleDB is one such case.
As a result, a logical replication apply worker can successfully apply changes and reach commit, but if the transaction has no top-level heap xid, PostgreSQL does not treat it as a participant in normal replication-origin advancement.
This breaks restart/replay correctness for subscriber-side logical apply.
Root Cause
RecordTransactionCommit()currently ties replication-origin advancement to the ordinary heap-XID commit path.Conceptually:
markXidCommitted == truemarkXidCommitted == falseThis means PostgreSQL currently has no general abstraction for:
Solution
Introduce a new transaction-level hook:
get_xidless_commit_lsn_hook.Its contract is narrow:
RecordTransactionCommit()This lets PostgreSQL remain the owner of commit/origin policy, while allowing a storage engine to provide the missing durable anchor.