Skip to content

Commit 905ce98

Browse files
committed
Properly set committed subtransactions in snapbuilder.
1 parent bb2b803 commit 905ce98

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

src/backend/replication/logical/decode.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -579,7 +579,7 @@ DecodeCommit(LogicalDecodingContext *ctx, XLogRecordBuffer *buf,
579579
}
580580

581581
SnapBuildCommitTxn(ctx->snapshot_builder, buf->origptr, xid,
582-
parsed->nsubxacts, parsed->subxacts, true);
582+
parsed->nsubxacts, parsed->subxacts, true, parsed->nmsgs > 0);
583583

584584
/* ----
585585
* Check whether we are interested in this specific transaction, and tell
@@ -646,7 +646,7 @@ DecodeCommit(LogicalDecodingContext *ctx, XLogRecordBuffer *buf,
646646
strcpy(ctx->reorder->gid, parsed->twophase_gid);
647647
*ctx->reorder->state_3pc = '\0';
648648
SnapBuildCommitTxn(ctx->snapshot_builder, buf->origptr, xid,
649-
parsed->nsubxacts, parsed->subxacts, true);
649+
parsed->nsubxacts, parsed->subxacts, true, false);
650650
ReorderBufferCommitBareXact(ctx->reorder, xid, buf->origptr, buf->endptr,
651651
commit_time, origin_id, origin_lsn);
652652
} else {

src/backend/replication/logical/snapbuild.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -948,7 +948,7 @@ SnapBuildAbortTxn(SnapBuild *builder, XLogRecPtr lsn,
948948
*/
949949
void
950950
SnapBuildCommitTxn(SnapBuild *builder, XLogRecPtr lsn, TransactionId xid,
951-
int nsubxacts, TransactionId *subxacts, bool isCommit)
951+
int nsubxacts, TransactionId *subxacts, bool isCommit, bool forceCatalog)
952952
{
953953
int nxact;
954954

@@ -1006,7 +1006,7 @@ SnapBuildCommitTxn(SnapBuild *builder, XLogRecPtr lsn, TransactionId xid,
10061006
* Add subtransaction to base snapshot if it DDL, we don't distinguish
10071007
* to toplevel transactions there.
10081008
*/
1009-
else if (ReorderBufferXidHasCatalogChanges(builder->reorder, subxid))
1009+
else if (ReorderBufferXidHasCatalogChanges(builder->reorder, subxid) || forceCatalog)
10101010
{
10111011
sub_needs_timetravel = true;
10121012

@@ -1034,7 +1034,7 @@ SnapBuildCommitTxn(SnapBuild *builder, XLogRecPtr lsn, TransactionId xid,
10341034
SnapBuildAddCommittedTxn(builder, xid);
10351035
}
10361036
/* add toplevel transaction to base snapshot */
1037-
else if (ReorderBufferXidHasCatalogChanges(builder->reorder, xid))
1037+
else if (ReorderBufferXidHasCatalogChanges(builder->reorder, xid) || forceCatalog)
10381038
{
10391039
elog(DEBUG2, "found top level transaction " XID_FMT ", with catalog changes!",
10401040
xid);

src/include/replication/snapbuild.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ extern bool SnapBuildXactNeedsSkip(SnapBuild *snapstate, XLogRecPtr ptr);
7070

7171
extern void SnapBuildCommitTxn(SnapBuild *builder, XLogRecPtr lsn,
7272
TransactionId xid, int nsubxacts,
73-
TransactionId *subxacts, bool isCommit);
73+
TransactionId *subxacts, bool isCommit, bool forceCatalog);
7474
extern void SnapBuildAbortTxn(SnapBuild *builder, XLogRecPtr lsn,
7575
TransactionId xid, int nsubxacts,
7676
TransactionId *subxacts);

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