@@ -724,27 +724,65 @@ OutputPluginWrite(ctx, true);
724
724
725
725
<sect1 id="logicaldecoding-synchronous">
726
726
<title>Synchronous Replication Support for Logical Decoding</title>
727
+ <sect2>
728
+ <title>Overview</title>
727
729
728
- <para>
729
- Logical decoding can be used to build
730
- <link linkend="synchronous-replication">synchronous
731
- replication</link> solutions with the same user interface as synchronous
732
- replication for <link linkend="streaming-replication">streaming
733
- replication</link>. To do this, the streaming replication interface
734
- (see <xref linkend="logicaldecoding-walsender"/>) must be used to stream out
735
- data. Clients have to send <literal>Standby status update (F)</literal>
736
- (see <xref linkend="protocol-replication"/>) messages, just like streaming
737
- replication clients do.
738
- </para>
739
-
740
- <note>
741
730
<para>
742
- A synchronous replica receiving changes via logical decoding will work in
743
- the scope of a single database. Since, in contrast to
744
- that, <parameter>synchronous_standby_names</parameter> currently is
745
- server wide, this means this technique will not work properly if more
746
- than one database is actively used.
731
+ Logical decoding can be used to build
732
+ <link linkend="synchronous-replication">synchronous
733
+ replication</link> solutions with the same user interface as synchronous
734
+ replication for <link linkend="streaming-replication">streaming
735
+ replication</link>. To do this, the streaming replication interface
736
+ (see <xref linkend="logicaldecoding-walsender"/>) must be used to stream out
737
+ data. Clients have to send <literal>Standby status update (F)</literal>
738
+ (see <xref linkend="protocol-replication"/>) messages, just like streaming
739
+ replication clients do.
740
+ </para>
741
+
742
+ <note>
743
+ <para>
744
+ A synchronous replica receiving changes via logical decoding will work in
745
+ the scope of a single database. Since, in contrast to
746
+ that, <parameter>synchronous_standby_names</parameter> currently is
747
+ server wide, this means this technique will not work properly if more
748
+ than one database is actively used.
747
749
</para>
748
- </note>
750
+ </note>
751
+ </sect2>
752
+
753
+ <sect2 id="logicaldecoding-synchronous-caveats">
754
+ <title>Caveats</title>
755
+
756
+ <para>
757
+ In synchronous replication setup, a deadlock can happen, if the transaction
758
+ has locked [user] catalog tables exclusively. This is because logical decoding of
759
+ transactions can lock catalog tables to access them. To avoid this users
760
+ must refrain from taking an exclusive lock on [user] catalog tables. This can
761
+ happen in the following ways:
762
+
763
+ <itemizedlist>
764
+ <listitem>
765
+ <para>
766
+ Issuing an explicit <command>LOCK</command> on <structname>pg_class</structname>
767
+ (or any other catalog table) in a transaction.
768
+ </para>
769
+ </listitem>
770
+
771
+ <listitem>
772
+ <para>
773
+ Perform <command>CLUSTER</command> on <structname>pg_class</structname> in a
774
+ transaction.
775
+ </para>
776
+ </listitem>
777
+
778
+ <listitem>
779
+ <para>
780
+ Executing <command>TRUNCATE</command> on [user] catalog table in a
781
+ transaction.
782
+ </para>
783
+ </listitem>
784
+ </itemizedlist>
785
+ </para>
786
+ </sect2>
749
787
</sect1>
750
788
</chapter>
0 commit comments