Doc: Explain prepared transaction lock waits with two_phase subscriptions. A transaction prepared by the apply worker retains its locks until the corresponding COMMIT PREPARED or ROLLBACK PREPARED is applied. If another session waits for a conflicting lock held by the prepared transaction, the apply worker's subsequent conflicting lock requests can queue behind that session. This can prevent the apply worker from reaching the COMMIT PREPARED or ROLLBACK PREPARED that would release the prepared transaction's locks.
The deadlock detector cannot detect this situation because a prepared transaction does not wait for any locks and therefore cannot participate in a deadlock cycle. As a result, replication can remain stalled indefinitely. Document this behavior and the recovery procedure under CREATE SUBSCRIPTION and PREPARE TRANSACTION. Author: Zhijie Hou <[email protected]> Reviewed-by: Bertrand Drouvot <[email protected]> Reviewed-by: Hayato Kuroda <[email protected]> Reviewed-by: shveta malik <[email protected]> Reviewed-by: Masahiko Sawada <[email protected]> Reviewed-by: Nisha Moond <[email protected]> Reviewed-by: Amit Kapila <[email protected]> Discussion: https://postgr.es/m/[email protected] Backpatch-through: 15 Branch ------ REL_16_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/d4f29ef8005b93478bd1dbcb8f41e5821e016743 Modified Files -------------- doc/src/sgml/ref/create_subscription.sgml | 16 ++++++++++++++++ doc/src/sgml/ref/prepare_transaction.sgml | 6 +++++- 2 files changed, 21 insertions(+), 1 deletion(-)
