mirror of
https://github.com/postgres/postgres.git
synced 2025-04-27 22:56:53 +03:00
Doc: Fix pg_copy_logical_replication_slot description.
This commit documents that the failover option is not copied when using the pg_copy_logical_replication_slot function. In passing, we modify the comments in the function clarifying the reason for this behavior. Reported-by: <duffieldzane@gmail.com> Author: Hou Zhijie <houzj.fnst@fujitsu.com> Reviewed-by: Amit Kapila <amit.kapila16@gmail.com> Backpatch-through: 17, where it was introduced Discussion: https://postgr.es/m/173976850802.682632.11315364077431550250@wrigleys.postgresql.org
This commit is contained in:
parent
15601fa21a
commit
5b8f2ccc0a
@ -29374,6 +29374,10 @@ postgres=# SELECT '0/0'::pg_lsn + pd.segment_number * ps.setting::int + :offset
|
|||||||
from the same <acronym>LSN</acronym> as the source logical slot. Both
|
from the same <acronym>LSN</acronym> as the source logical slot. Both
|
||||||
<parameter>temporary</parameter> and <parameter>plugin</parameter> are
|
<parameter>temporary</parameter> and <parameter>plugin</parameter> are
|
||||||
optional; if they are omitted, the values of the source slot are used.
|
optional; if they are omitted, the values of the source slot are used.
|
||||||
|
The <literal>failover</literal> option of the source logical slot
|
||||||
|
is not copied and is set to <literal>false</literal> by default. This
|
||||||
|
is to avoid the risk of being unable to continue logical replication
|
||||||
|
after failover to standby where the slot is being synchronized.
|
||||||
</para></entry>
|
</para></entry>
|
||||||
</row>
|
</row>
|
||||||
|
|
||||||
|
@ -695,13 +695,18 @@ copy_replication_slot(FunctionCallInfo fcinfo, bool logical_slot)
|
|||||||
* hence pass find_startpoint false. confirmed_flush will be set
|
* hence pass find_startpoint false. confirmed_flush will be set
|
||||||
* below, by copying from the source slot.
|
* below, by copying from the source slot.
|
||||||
*
|
*
|
||||||
* To avoid potential issues with the slot synchronization where the
|
* We don't copy the failover option to prevent potential issues with
|
||||||
* restart_lsn of a replication slot can go backward, we set the
|
* slot synchronization. For instance, if a slot was synchronized to
|
||||||
* failover option to false here. This situation occurs when a slot
|
* the standby, then dropped on the primary, and immediately recreated
|
||||||
* on the primary server is dropped and immediately replaced with a
|
* by copying from another existing slot with much earlier restart_lsn
|
||||||
* new slot of the same name, created by copying from another existing
|
* and confirmed_flush_lsn, the slot synchronization would only
|
||||||
* slot. However, the slot synchronization will only observe the
|
* observe the LSN of the same slot moving backward. As slot
|
||||||
* restart_lsn of the same slot going backward.
|
* synchronization does not copy the restart_lsn and
|
||||||
|
* confirmed_flush_lsn backward (see update_local_synced_slot() for
|
||||||
|
* details), if a failover happens before the primary's slot catches
|
||||||
|
* up, logical replication cannot continue using the synchronized slot
|
||||||
|
* on the promoted standby because the slot retains the restart_lsn
|
||||||
|
* and confirmed_flush_lsn that are much later than expected.
|
||||||
*/
|
*/
|
||||||
create_logical_replication_slot(NameStr(*dst_name),
|
create_logical_replication_slot(NameStr(*dst_name),
|
||||||
plugin,
|
plugin,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user