aboutsummaryrefslogtreecommitdiff
path: root/doc/src
diff options
context:
space:
mode:
authorAmit Kapila <akapila@postgresql.org>2024-02-22 15:25:15 +0530
committerAmit Kapila <akapila@postgresql.org>2024-02-22 15:25:15 +0530
commit93db6cbda037f1be9544932bd9a785dabf3ff712 (patch)
tree804da2c1a7ee4634dc92789c98fa611dada365de /doc/src
parent3d47b75546d1ef70145f58e162a96f7e0c649389 (diff)
downloadpostgresql-93db6cbda037f1be9544932bd9a785dabf3ff712.tar.gz
postgresql-93db6cbda037f1be9544932bd9a785dabf3ff712.zip
Add a new slot sync worker to synchronize logical slots.
By enabling slot synchronization, all the failover logical replication slots on the primary (assuming configurations are appropriate) are automatically created on the physical standbys and are synced periodically. The slot sync worker on the standby server pings the primary server at regular intervals to get the necessary failover logical slots information and create/update the slots locally. The slots that no longer require synchronization are automatically dropped by the worker. The nap time of the worker is tuned according to the activity on the primary. The slot sync worker waits for some time before the next synchronization, with the duration varying based on whether any slots were updated during the last cycle. A new parameter sync_replication_slots enables or disables this new process. On promotion, the slot sync worker is shut down by the startup process to drop any temporary slots acquired by the slot sync worker and to prevent the worker from trying to fetch the failover slots. A functionality to allow logical walsenders to wait for the physical will be done in a subsequent commit. Author: Shveta Malik, Hou Zhijie based on design inputs by Masahiko Sawada and Amit Kapila Reviewed-by: Masahiko Sawada, Bertrand Drouvot, Peter Smith, Dilip Kumar, Ajin Cherian, Nisha Moond, Kuroda Hayato, Amit Kapila Discussion: https://postgr.es/m/514f6f2f-6833-4539-39f1-96cd1e011f23@enterprisedb.com
Diffstat (limited to 'doc/src')
-rw-r--r--doc/src/sgml/config.sgml18
-rw-r--r--doc/src/sgml/logicaldecoding.sgml5
2 files changed, 22 insertions, 1 deletions
diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml
index ffd711b7f21..ff184003feb 100644
--- a/doc/src/sgml/config.sgml
+++ b/doc/src/sgml/config.sgml
@@ -4943,6 +4943,24 @@ ANY <replaceable class="parameter">num_sync</replaceable> ( <replaceable class="
</listitem>
</varlistentry>
+ <varlistentry id="guc-sync-replication-slots" xreflabel="sync_replication_slots">
+ <term><varname>sync_replication_slots</varname> (<type>boolean</type>)
+ <indexterm>
+ <primary><varname>sync_replication_slots</varname> configuration parameter</primary>
+ </indexterm>
+ </term>
+ <listitem>
+ <para>
+ It enables a physical standby to synchronize logical failover slots
+ from the primary server so that logical subscribers can resume
+ replication from the new primary server after failover.
+ </para>
+ <para>
+ It is disabled by default. This parameter can only be set in the
+ <filename>postgresql.conf</filename> file or on the server command line.
+ </para>
+ </listitem>
+ </varlistentry>
</variablelist>
</sect2>
diff --git a/doc/src/sgml/logicaldecoding.sgml b/doc/src/sgml/logicaldecoding.sgml
index eceaaaa2735..930c0fa8a6d 100644
--- a/doc/src/sgml/logicaldecoding.sgml
+++ b/doc/src/sgml/logicaldecoding.sgml
@@ -373,7 +373,10 @@ postgres=# select * from pg_logical_slot_get_changes('regression_slot', NULL, NU
<command>CREATE SUBSCRIPTION</command> during slot creation, and then calling
<link linkend="pg-sync-replication-slots">
<function>pg_sync_replication_slots</function></link>
- on the standby. For the synchronization to work, it is mandatory to
+ on the standby. By setting <link linkend="guc-sync-replication-slots">
+ <varname>sync_replication_slots</varname></link>
+ on the standby, the failover slots can be synchronized periodically in
+ the slotsync worker. For the synchronization to work, it is mandatory to
have a physical replication slot between the primary and the standby aka
<link linkend="guc-primary-slot-name"><varname>primary_slot_name</varname></link>
should be configured on the standby, and