Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc63e5b2

Browse files
committed
Move SnapBuildCommitTxn() from prepare to commit/abort.
Previous behaviour was wrong as in case of abort transactionwere vesible in snapshot.
1 parentb518b35 commitc63e5b2

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

‎src/backend/replication/logical/decode.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -645,6 +645,8 @@ DecodeCommit(LogicalDecodingContext *ctx, XLogRecordBuffer *buf,
645645
*/
646646
strcpy(ctx->reorder->gid,parsed->twophase_gid);
647647
*ctx->reorder->state_3pc='\0';
648+
SnapBuildCommitTxn(ctx->snapshot_builder,buf->origptr,xid,
649+
parsed->nsubxacts,parsed->subxacts, true);
648650
ReorderBufferCommitBareXact(ctx->reorder,xid,buf->origptr,buf->endptr,
649651
commit_time,origin_id,origin_lsn);
650652
}else {
@@ -699,9 +701,6 @@ DecodePrepare(LogicalDecodingContext *ctx, XLogRecordBuffer *buf,
699701
ReorderBufferXidSetCatalogChanges(rb,xid,buf->origptr);
700702
}
701703

702-
SnapBuildCommitTxn(ctx->snapshot_builder,buf->origptr,xid,
703-
parsed->nsubxacts,parsed->subxacts, false);
704-
705704
if (SnapBuildXactNeedsSkip(ctx->snapshot_builder,buf->origptr)||
706705
(parsed->dbId!=InvalidOid&&parsed->dbId!=ctx->slot->data.database)||
707706
FilterByOrigin(ctx,origin_id))
@@ -777,6 +776,8 @@ DecodeAbort(LogicalDecodingContext *ctx, XLogRecordBuffer *buf,
777776
strcpy(ctx->reorder->gid,parsed->twophase_gid);
778777
*ctx->reorder->state_3pc='\0';
779778

779+
SnapBuildAbortTxn(ctx->snapshot_builder,buf->record->EndRecPtr,xid,
780+
parsed->nsubxacts,parsed->subxacts);
780781
ReorderBufferCommitBareXact(ctx->reorder,xid,buf->origptr,buf->endptr,
781782
commit_time,origin_id,origin_lsn);
782783
}

‎src/backend/replication/logical/reorderbuffer.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1728,6 +1728,10 @@ ReorderBufferCommitBareXact(ReorderBuffer *rb, TransactionId xid,
17281728
txn=ReorderBufferTXNByXid(rb,xid, true,NULL,commit_lsn,
17291729
true);
17301730

1731+
if (rb->xact_action==XLOG_XACT_ABORT_PREPARED) {
1732+
ReorderBufferCleanupTXN(rb,txn);
1733+
}
1734+
17311735
txn->final_lsn=commit_lsn;
17321736
txn->end_lsn=end_lsn;
17331737
txn->commit_time=commit_time;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp