Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 6704d40

Browse files
committed
do not remove prepared tx from running list while 2pc decoding. fixes #23
1 parent d7308cb commit 6704d40

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

src/backend/replication/logical/decode.c

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

576576
SnapBuildCommitTxn(ctx->snapshot_builder, buf->origptr, xid,
577-
parsed->nsubxacts, parsed->subxacts);
577+
parsed->nsubxacts, parsed->subxacts, true);
578578

579579
/* ----
580580
* Check whether we are interested in this specific transaction, and tell
@@ -678,7 +678,7 @@ DecodePrepare(LogicalDecodingContext *ctx, XLogRecordBuffer *buf,
678678
}
679679

680680
SnapBuildCommitTxn(ctx->snapshot_builder, buf->origptr, xid,
681-
parsed->nsubxacts, parsed->subxacts);
681+
parsed->nsubxacts, parsed->subxacts, false);
682682

683683
if (SnapBuildXactNeedsSkip(ctx->snapshot_builder, buf->origptr) ||
684684
(parsed->dbId != InvalidOid && parsed->dbId != ctx->slot->data.database) ||

src/backend/replication/logical/snapbuild.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -950,7 +950,7 @@ SnapBuildAbortTxn(SnapBuild *builder, XLogRecPtr lsn,
950950
*/
951951
void
952952
SnapBuildCommitTxn(SnapBuild *builder, XLogRecPtr lsn, TransactionId xid,
953-
int nsubxacts, TransactionId *subxacts)
953+
int nsubxacts, TransactionId *subxacts, bool isCommit)
954954
{
955955
int nxact;
956956

@@ -1026,7 +1026,8 @@ SnapBuildCommitTxn(SnapBuild *builder, XLogRecPtr lsn, TransactionId xid,
10261026
* Make sure toplevel txn is not tracked in running txn's anymore, switch
10271027
* state to consistent if possible.
10281028
*/
1029-
SnapBuildEndTxn(builder, lsn, xid);
1029+
if (isCommit)
1030+
SnapBuildEndTxn(builder, lsn, xid);
10301031

10311032
if (forced_timetravel)
10321033
{

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);
73+
TransactionId *subxacts, bool isCommit);
7474
extern void SnapBuildAbortTxn(SnapBuild *builder, XLogRecPtr lsn,
7575
TransactionId xid, int nsubxacts,
7676
TransactionId *subxacts);

0 commit comments

Comments
 (0)