mirror of
https://github.com/postgres/postgres.git
synced 2025-11-09 06:21:09 +03:00
Track replication origin progress for rollbacks.
Commit1eb6d6527aallowed to track replica origin replay progress for 2PC but it was not complete. It misses to properly track the progress for rollback prepared especially it missed updating the code for recovery. Additionally, we need to allow tracking it on subscriber nodes where wal_level might not be logical. It is required to track decoding of 2PC which is committed in PG14 (a271a1b50e) and also nobody complained about this till now so not backpatching it. Author: Amit Kapila Reviewed-by: Michael Paquier and Ajin Cherian Discussion: https://postgr.es/m/CAA4eK1L-kHmMnSdrRW6UhRbCjR7cgh04c+6psY15qzT6ktcd+g@mail.gmail.com
This commit is contained in:
@@ -2276,6 +2276,14 @@ RecordTransactionAbortPrepared(TransactionId xid,
|
||||
const char *gid)
|
||||
{
|
||||
XLogRecPtr recptr;
|
||||
bool replorigin;
|
||||
|
||||
/*
|
||||
* Are we using the replication origins feature? Or, in other words, are
|
||||
* we replaying remote actions?
|
||||
*/
|
||||
replorigin = (replorigin_session_origin != InvalidRepOriginId &&
|
||||
replorigin_session_origin != DoNotReplicateId);
|
||||
|
||||
/*
|
||||
* Catch the scenario where we aborted partway through
|
||||
@@ -2298,6 +2306,11 @@ RecordTransactionAbortPrepared(TransactionId xid,
|
||||
MyXactFlags | XACT_FLAGS_ACQUIREDACCESSEXCLUSIVELOCK,
|
||||
xid, gid);
|
||||
|
||||
if (replorigin)
|
||||
/* Move LSNs forward for this replication origin */
|
||||
replorigin_session_advance(replorigin_session_origin_lsn,
|
||||
XactLastRecEnd);
|
||||
|
||||
/* Always flush, since we're about to remove the 2PC state file */
|
||||
XLogFlush(recptr);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user