mirror of
https://github.com/postgres/postgres.git
synced 2025-10-25 13:17:41 +03:00
Introduce a new GUC 'standby_slot_names'.
This patch provides a way to ensure that physical standbys that are potential failover candidates have received and flushed changes before the primary server making them visible to subscribers. Doing so guarantees that the promoted standby server is not lagging behind the subscribers when a failover is necessary. The logical walsender now guarantees that all local changes are sent and flushed to the standby servers corresponding to the replication slots specified in 'standby_slot_names' before sending those changes to the subscriber. Additionally, the SQL functions pg_logical_slot_get_changes, pg_logical_slot_peek_changes and pg_replication_slot_advance are modified to ensure that they process changes for failover slots only after physical slots specified in 'standby_slot_names' have confirmed WAL receipt for those. Author: Hou Zhijie and Shveta Malik Reviewed-by: Masahiko Sawada, Peter Smith, Bertrand Drouvot, Ajin Cherian, Nisha Moond, Amit Kapila Discussion: https://postgr.es/m/514f6f2f-6833-4539-39f1-96cd1e011f23@enterprisedb.com
This commit is contained in:
@@ -384,6 +384,18 @@ postgres=# select * from pg_logical_slot_get_changes('regression_slot', NULL, NU
|
||||
must be enabled on the standby. It is also necessary to specify a valid
|
||||
<literal>dbname</literal> in the
|
||||
<link linkend="guc-primary-conninfo"><varname>primary_conninfo</varname></link>.
|
||||
It's highly recommended that the said physical replication slot is named in
|
||||
<link linkend="guc-standby-slot-names"><varname>standby_slot_names</varname></link>
|
||||
list on the primary, to prevent the subscriber from consuming changes
|
||||
faster than the hot standby. Even when correctly configured, some latency
|
||||
is expected when sending changes to logical subscribers due to the waiting
|
||||
on slots named in
|
||||
<link linkend="guc-standby-slot-names"><varname>standby_slot_names</varname></link>.
|
||||
When <varname>standby_slot_names</varname> is utilized, the
|
||||
primary server will not completely shut down until the corresponding
|
||||
standbys, associated with the physical replication slots specified
|
||||
in <varname>standby_slot_names</varname>, have confirmed
|
||||
receiving the WAL up to the latest flushed position on the primary server.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
|
||||
Reference in New Issue
Block a user