| From: | Amit Kapila <akapila(at)postgresql(dot)org> |
|---|---|
| To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
| Subject: | pgsql: Doc: Explain prepared transaction lock waits with two_phase subs |
| Date: | 2026-11-18 05:19:45 |
| Message-ID: | E1xTY5A-00000000CAZ-05GA@gemulon.postgresql.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-committers |
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 <houzhijie22(at)gmail(dot)com>
Reviewed-by: Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>
Reviewed-by: Hayato Kuroda <kuroda(dot)hayato(at)fujitsu(dot)com>
Reviewed-by: shveta malik <shveta(dot)malik(at)gmail(dot)com>
Reviewed-by: Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>
Reviewed-by: Nisha Moond <nisha(dot)moond412(at)gmail(dot)com>
Reviewed-by: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
Discussion: https://postgr.es/m/72c9b956-96c3-40a5-99bb-d9b7338c0bab@gmail.com
Backpatch-through: 15
Branch
------
REL_15_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/75a43054370062a37ce3a436d78922565336a1ab
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(-)
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Fujii Masao | 2026-11-18 07:10:03 | pgsql: Fix temporary relation I/O statistics in single-user mode |
| Previous Message | Amit Kapila | 2026-11-18 05:19:44 | pgsql: Doc: Explain prepared transaction lock waits with two_phase subs |