Commit f25a4584 authored by Amit Kapila's avatar Amit Kapila

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
parent 3cbea581
...@@ -2690,8 +2690,11 @@ ReorderBufferPrepare(ReorderBuffer *rb, TransactionId xid, ...@@ -2690,8 +2690,11 @@ ReorderBufferPrepare(ReorderBuffer *rb, TransactionId xid,
* We send the prepare for the concurrently aborted xacts so that later * We send the prepare for the concurrently aborted xacts so that later
* when rollback prepared is decoded and sent, the downstream should be * when rollback prepared is decoded and sent, the downstream should be
* able to rollback such a xact. See comments atop DecodePrepare. * able to rollback such a xact. See comments atop DecodePrepare.
*
* Note, for the concurrent_abort + streaming case a stream_prepare was
* already sent within the ReorderBufferReplay call above.
*/ */
if (txn->concurrent_abort) if (txn->concurrent_abort && !rbtxn_is_streamed(txn))
rb->prepare(rb, txn, txn->final_lsn); rb->prepare(rb, txn, txn->final_lsn);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment