From 625104cc0448ceea738c9151c5b9ccbeb0c1e125 Mon Sep 17 00:00:00 2001
From: Osumi Takamichi <osumi.takamichi@fujitsu.com>
Date: Thu, 10 Jun 2021 10:57:52 +0000
Subject: [PATCH v05] additional deadlock scenarios of synchronous logical decoding

Add (1) more scenario descriptions specific to two phase commit
to the exising deadlock list of synchronous logical decoding
and (2) a reference to this caveats from another section of Two-phase commit.

Author: Takamichi Osumi <osumi.takamichi@fujitsu.com>
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>
Reviewed-by: Vignesh C <vignesh21@gmail.com>
Discussion: https://www.postgresql.org/message-id/20210222222847.tpnb6eg3yiykzpky%40alap3.anarazel.de
---
 doc/src/sgml/logicaldecoding.sgml | 23 ++++++++++++++++++++---
 1 file changed, 20 insertions(+), 3 deletions(-)

diff --git a/doc/src/sgml/logicaldecoding.sgml b/doc/src/sgml/logicaldecoding.sgml
index 51a5060..0a021c5 100644
--- a/doc/src/sgml/logicaldecoding.sgml
+++ b/doc/src/sgml/logicaldecoding.sgml
@@ -1127,6 +1127,22 @@ OutputPluginWrite(ctx, true);
 
       <listitem>
        <para>
+        Performing <command>PREPARE TRANSACTION</command> after <command>LOCK</command>
+        command on <structname>pg_class</structname> and logical decoding of published
+        table.
+       </para>
+      </listitem>
+
+      <listitem>
+       <para>
+        Clustering <structname>pg_trigger</structname> and decoding <command>PREPARE
+        TRANSACTION</command>, if any published table have a trigger and any
+        operations that will be decoded are conducted.
+       </para>
+      </listitem>
+
+      <listitem>
+       <para>
         Executing <command>TRUNCATE</command> on user_catalog_table in a transaction.
        </para>
       </listitem>
@@ -1298,9 +1314,10 @@ stream_commit_cb(...);  &lt;-- commit of the streamed transaction
       <para>
        The logical replication solution that builds distributed two phase commit
        using this feature can deadlock if the prepared transaction has locked
-       [user] catalog tables exclusively. They need to inform users to not have
-       locks on catalog tables (via explicit <command>LOCK</command> command) in
-       such transactions.
+       [user] catalog tables exclusively. To avoid this users must refrain from
+       having locks on catalog tables (e.g. explicit <command>LOCK</command> command)
+       in such transactions.
+       (See <xref linkend="logicaldecoding-synchronous-caveats"/> for the details.)
       </para>
      </listitem>
     </itemizedlist>
-- 
2.2.0

