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