Skip to content

Commit 1801ced

Browse files
committed
origin info in commit messages
1 parent 9189353 commit 1801ced

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

contrib/test_decoding/sql/prepared.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,6 @@ DROP TABLE test_prepared2;
4848
SELECT data FROM pg_logical_slot_peek_changes('regression_slot', NULL, NULL, 'include-xids', '0', 'skip-empty-xacts', '1');
4949

5050
-- same but with twophase decoding
51-
SELECT data FROM pg_logical_slot_peek_changes('regression_slot', NULL, NULL, 'include-xids', '0', 'skip-empty-xacts', '1', 'twophase-decoding', '1') ;
51+
SELECT data FROM pg_logical_slot_peek_changes('regression_slot', NULL, NULL, 'include-xids', '0', 'skip-empty-xacts', '1', 'twophase-decoding', '1');
5252

5353
SELECT pg_drop_replication_slot('regression_slot');

src/backend/replication/logical/decode.c

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -651,6 +651,12 @@ DecodePrepare(LogicalDecodingContext *ctx, XLogRecordBuffer *buf,
651651
int i;
652652
TransactionId xid = parsed->twophase_xid;
653653

654+
if (parsed->xinfo & XACT_XINFO_HAS_ORIGIN)
655+
{
656+
origin_lsn = parsed->origin_lsn;
657+
commit_time = parsed->origin_timestamp;
658+
}
659+
654660
/*
655661
* Process invalidation messages, even if we're not interested in the
656662
* transaction's contents, since the various caches need to always be
@@ -703,9 +709,15 @@ DecodeAbort(LogicalDecodingContext *ctx, XLogRecordBuffer *buf,
703709
{
704710
int i;
705711
XLogRecPtr origin_lsn = InvalidXLogRecPtr;
706-
XLogRecPtr commit_time = InvalidXLogRecPtr;
712+
TimestampTz commit_time = 0;
707713
XLogRecPtr origin_id = XLogRecGetOrigin(buf->record);
708714

715+
if (parsed->xinfo & XACT_XINFO_HAS_ORIGIN)
716+
{
717+
origin_lsn = parsed->origin_lsn;
718+
commit_time = parsed->origin_timestamp;
719+
}
720+
709721
/*
710722
* If that is ROLLBACK PREPARED than send that to callbacks.
711723
*/

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy