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

Commit2ce353f

Browse files
author
Amit Kapila
committed
Tighten the concurrent abort check during decoding.
During decoding of an in-progress or prepared transaction, we detectconcurrent abort with an error code ERRCODE_TRANSACTION_ROLLBACK. That isnot sufficient because a callback can decide to throw that error codeat other times as well.Reported-by: Tom LaneAuthor: Amit KapilaReviewed-by: Dilip KumarDiscussion:https://postgr.es/m/CAA4eK1KCjPRS4aZHB48QMM4J8XOC1+TD8jo-4Yu84E+MjwqVhA@mail.gmail.com
1 parentc250062 commit2ce353f

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

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

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2492,17 +2492,18 @@ ReorderBufferProcessTXN(ReorderBuffer *rb, ReorderBufferTXN *txn,
24922492
* abort of the (sub)transaction we are streaming or preparing. We
24932493
* need to do the cleanup and return gracefully on this error, see
24942494
* SetupCheckXidLive.
2495+
*
2496+
* This error code can be thrown by one of the callbacks we call during
2497+
* decoding so we need to ensure that we return gracefully only when we are
2498+
* sending the data in streaming mode and the streaming is not finished yet
2499+
* or when we are sending the data out on a PREPARE during a two-phase
2500+
* commit.
24952501
*/
2496-
if (errdata->sqlerrcode==ERRCODE_TRANSACTION_ROLLBACK)
2502+
if (errdata->sqlerrcode==ERRCODE_TRANSACTION_ROLLBACK&&
2503+
(stream_started||rbtxn_prepared(txn)))
24972504
{
2498-
/*
2499-
* This error can occur either when we are sending the data in
2500-
* streaming mode and the streaming is not finished yet or when we
2501-
* are sending the data out on a PREPARE during a two-phase
2502-
* commit.
2503-
*/
2504-
Assert(streaming||rbtxn_prepared(txn));
2505-
Assert(stream_started||rbtxn_prepared(txn));
2505+
/* curtxn must be set for streaming or prepared transactions */
2506+
Assert(curtxn);
25062507

25072508
/* Cleanup the temporary error state. */
25082509
FlushErrorState();

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp