@@ -684,27 +684,65 @@ OutputPluginWrite(ctx, true);
684
684
685
685
<sect1 id="logicaldecoding-synchronous">
686
686
<title>Synchronous Replication Support for Logical Decoding</title>
687
+ <sect2>
688
+ <title>Overview</title>
687
689
688
- <para>
689
- Logical decoding can be used to build
690
- <link linkend="synchronous-replication">synchronous
691
- replication</link> solutions with the same user interface as synchronous
692
- replication for <link linkend="streaming-replication">streaming
693
- replication</link>. To do this, the streaming replication interface
694
- (see <xref linkend="logicaldecoding-walsender">) must be used to stream out
695
- data. Clients have to send <literal>Standby status update (F)</literal>
696
- (see <xref linkend="protocol-replication">) messages, just like streaming
697
- replication clients do.
698
- </para>
699
-
700
- <note>
701
690
<para>
702
- A synchronous replica receiving changes via logical decoding will work in
703
- the scope of a single database. Since, in contrast to
704
- that, <parameter>synchronous_standby_names</parameter> currently is
705
- server wide, this means this technique will not work properly if more
706
- than one database is actively used.
691
+ Logical decoding can be used to build
692
+ <link linkend="synchronous-replication">synchronous
693
+ replication</link> solutions with the same user interface as synchronous
694
+ replication for <link linkend="streaming-replication">streaming
695
+ replication</link>. To do this, the streaming replication interface
696
+ (see <xref linkend="logicaldecoding-walsender">) must be used to stream out
697
+ data. Clients have to send <literal>Standby status update (F)</literal>
698
+ (see <xref linkend="protocol-replication">) messages, just like streaming
699
+ replication clients do.
700
+ </para>
701
+
702
+ <note>
703
+ <para>
704
+ A synchronous replica receiving changes via logical decoding will work in
705
+ the scope of a single database. Since, in contrast to
706
+ that, <parameter>synchronous_standby_names</parameter> currently is
707
+ server wide, this means this technique will not work properly if more
708
+ than one database is actively used.
707
709
</para>
708
- </note>
710
+ </note>
711
+ </sect2>
712
+
713
+ <sect2 id="logicaldecoding-synchronous-caveats">
714
+ <title>Caveats</title>
715
+
716
+ <para>
717
+ In synchronous replication setup, a deadlock can happen, if the transaction
718
+ has locked [user] catalog tables exclusively. This is because logical decoding of
719
+ transactions can lock catalog tables to access them. To avoid this users
720
+ must refrain from taking an exclusive lock on [user] catalog tables. This can
721
+ happen in the following ways:
722
+
723
+ <itemizedlist>
724
+ <listitem>
725
+ <para>
726
+ Issuing an explicit <command>LOCK</command> on <structname>pg_class</structname>
727
+ (or any other catalog table) in a transaction.
728
+ </para>
729
+ </listitem>
730
+
731
+ <listitem>
732
+ <para>
733
+ Perform <command>CLUSTER</command> on <structname>pg_class</structname> in a
734
+ transaction.
735
+ </para>
736
+ </listitem>
737
+
738
+ <listitem>
739
+ <para>
740
+ Executing <command>TRUNCATE</command> on [user] catalog table in a
741
+ transaction.
742
+ </para>
743
+ </listitem>
744
+ </itemizedlist>
745
+ </para>
746
+ </sect2>
709
747
</sect1>
710
748
</chapter>
0 commit comments