Skip to content

Commit f25a458

Browse files
author
Amit Kapila
committed
Avoid sending prepare multiple times while decoding.
We send the prepare for the concurrently aborted xacts so that later when rollback prepared is decoded and sent, the downstream should be able to rollback such a xact. For 'streaming' case (when we send changes for in-progress transactions), we were sending prepare twice when concurrent abort was detected. Author: Peter Smith Reviewed-by: Amit Kapila Discussion: https://postgr.es/m/f82133c6-6055-b400-7922-97dae9f2b50b@enterprisedb.com
1 parent 3cbea58 commit f25a458

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/backend/replication/logical/reorderbuffer.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2690,8 +2690,11 @@ ReorderBufferPrepare(ReorderBuffer *rb, TransactionId xid,
26902690
* We send the prepare for the concurrently aborted xacts so that later
26912691
* when rollback prepared is decoded and sent, the downstream should be
26922692
* able to rollback such a xact. See comments atop DecodePrepare.
2693+
*
2694+
* Note, for the concurrent_abort + streaming case a stream_prepare was
2695+
* already sent within the ReorderBufferReplay call above.
26932696
*/
2694-
if (txn->concurrent_abort)
2697+
if (txn->concurrent_abort && !rbtxn_is_streamed(txn))
26952698
rb->prepare(rb, txn, txn->final_lsn);
26962699
}
26972700

0 commit comments

Comments
 (0)