@@ -457,6 +457,9 @@ DecodeCommit(LogicalDecodingContext *ctx, XLogRecordBuffer *buf,
457
457
commit_time = parsed -> origin_timestamp ;
458
458
}
459
459
460
+ /*
461
+ * If that is COMMIT PREPARED than send that to callbacks.
462
+ */
460
463
if (TransactionIdIsValid (parsed -> twophase_xid )) {
461
464
strcpy (ctx -> reorder -> gid , parsed -> twophase_gid );
462
465
ReorderBufferCommitBareXact (ctx -> reorder , xid , buf -> origptr , buf -> endptr ,
@@ -548,13 +551,6 @@ DecodePrepare(LogicalDecodingContext *ctx, XLogRecordBuffer *buf)
548
551
RelFileNode * abortrels ;
549
552
SharedInvalidationMessage * invalmsgs ;
550
553
551
- // probably there are no origin -- origin stored in hdr
552
- // if (parsed->xinfo & XACT_XINFO_HAS_ORIGIN)
553
- // {
554
- // origin_lsn = parsed->origin_lsn;
555
- // commit_time = parsed->origin_timestamp;
556
- // }
557
-
558
554
xid = XLogRecGetXid (r );
559
555
twophase_buf = XLogRecGetData (r );
560
556
twophase_len = sizeof (char ) * XLogRecGetDataLen (r );
@@ -588,8 +584,8 @@ DecodePrepare(LogicalDecodingContext *ctx, XLogRecordBuffer *buf)
588
584
SnapBuildCommitTxn (ctx -> snapshot_builder , buf -> origptr , xid ,
589
585
hdr -> nsubxacts , children );
590
586
591
- // Add db check here
592
587
if (SnapBuildXactNeedsSkip (ctx -> snapshot_builder , buf -> origptr ) ||
588
+ (hdr -> database != InvalidOid && hdr -> database != ctx -> slot -> data .database ) ||
593
589
FilterByOrigin (ctx , origin_id ))
594
590
{
595
591
for (i = 0 ; i < hdr -> nsubxacts ; i ++ )
@@ -626,6 +622,9 @@ DecodeAbort(LogicalDecodingContext *ctx, XLogRecordBuffer *buf,
626
622
XLogRecPtr commit_time = InvalidXLogRecPtr ;
627
623
XLogRecPtr origin_id = XLogRecGetOrigin (buf -> record );
628
624
625
+ /*
626
+ * If that is ROLLBACK PREPARED than send that to callbacks.
627
+ */
629
628
if (TransactionIdIsValid (parsed -> twophase_xid )) {
630
629
strcpy (ctx -> reorder -> gid , parsed -> twophase_gid );
631
630
ReorderBufferCommitBareXact (ctx -> reorder , xid , buf -> origptr , buf -> endptr ,
0 commit comments