Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit7c906c5

Browse files
author
Amit Kapila
committed
Doc: Fix pg_copy_logical_replication_slot description.
This commit documents that the failover option is not copied when usingthe pg_copy_logical_replication_slot function.In passing, we modify the comments in the function clarifying the reasonfor 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 introducedDiscussion:https://postgr.es/m/173976850802.682632.11315364077431550250@wrigleys.postgresql.org
1 parent174952e commit7c906c5

File tree

2 files changed

+16
-7
lines changed

2 files changed

+16
-7
lines changed

‎doc/src/sgml/func.sgml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29118,6 +29118,10 @@ postgres=# SELECT '0/0'::pg_lsn + pd.segment_number * ps.setting::int + :offset
2911829118
from the same <acronym>LSN</acronym> as the source logical slot. Both
2911929119
<parameter>temporary</parameter> and <parameter>plugin</parameter> are
2912029120
optional; if they are omitted, the values of the source slot are used.
29121+
The <literal>failover</literal> option of the source logical slot
29122+
is not copied and is set to <literal>false</literal> by default. This
29123+
is to avoid the risk of being unable to continue logical replication
29124+
after failover to standby where the slot is being synchronized.
2912129125
</para></entry>
2912229126
</row>
2912329127

‎src/backend/replication/slotfuncs.c

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -698,13 +698,18 @@ copy_replication_slot(FunctionCallInfo fcinfo, bool logical_slot)
698698
* hence pass find_startpoint false. confirmed_flush will be set
699699
* below, by copying from the source slot.
700700
*
701-
* To avoid potential issues with the slot synchronization where the
702-
* restart_lsn of a replication slot can go backward, we set the
703-
* failover option to false here. This situation occurs when a slot
704-
* on the primary server is dropped and immediately replaced with a
705-
* new slot of the same name, created by copying from another existing
706-
* slot. However, the slot synchronization will only observe the
707-
* restart_lsn of the same slot going backward.
701+
* We don't copy the failover option to prevent potential issues with
702+
* slot synchronization. For instance, if a slot was synchronized to
703+
* the standby, then dropped on the primary, and immediately recreated
704+
* by copying from another existing slot with much earlier restart_lsn
705+
* and confirmed_flush_lsn, the slot synchronization would only
706+
* observe the LSN of the same slot moving backward. As slot
707+
* synchronization does not copy the restart_lsn and
708+
* confirmed_flush_lsn backward (see update_local_synced_slot() for
709+
* details), if a failover happens before the primary's slot catches
710+
* up, logical replication cannot continue using the synchronized slot
711+
* on the promoted standby because the slot retains the restart_lsn
712+
* and confirmed_flush_lsn that are much later than expected.
708713
*/
709714
create_logical_replication_slot(NameStr(*dst_name),
710715
plugin,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp