Re: pg_copy_logical_replication_slot doesn't copy the failover property

From: Shlok Kyal <shlok(dot)kyal(dot)oss(at)gmail(dot)com>
To: duffieldzane(at)gmail(dot)com, pgsql-docs(at)lists(dot)postgresql(dot)org
Subject: Re: pg_copy_logical_replication_slot doesn't copy the failover property
Date: 2025-02-19 07:10:34
Message-ID: CANhcyEU_58pUgAoDMgvvjEPtiqUQZaEoiZhX_27zY7qJuyr8Og@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs pgsql-hackers

On Tue, 18 Feb 2025 at 19:49, PG Doc comments form
<noreply(at)postgresql(dot)org> wrote:
>
> The following documentation comment has been logged on the website:
>
> Page: https://www.postgresql.org/docs/17/functions-admin.html
> Description:
>
> The documentation for pg_copy_logical_replication_slot doesn't mention that
> the failover property for the logical slot is not copied.
>
> I assumed there was a good reason for this, and I found a comment in the
> source code that explains it (although I don't really understand).
> It says
> * To avoid potential issues with the slot synchronization where the
> * restart_lsn of a replication slot can go backward, we set the
> * failover option to false here. This situation occurs when a slot
> * on the primary server is dropped and immediately replaced with a
> * new slot of the same name, created by copying from another existing
> * slot. However, the slot synchronization will only observe the
> * restart_lsn of the same slot going backward.
>
> I assumed that by default, all properties from the original slot would be
> copied, so this function left me wondering why my logical replication slots
> were not being synced to the replica.

Hi,

The failover option is set to false by default while copying of the
slots as it may cause some issue during slot synchronization as per
discussion [1].

I have created a patch to update the documentation for the same.

[1]: https://www.postgresql.org/message-id/CAD21AoCoX%2Bjhy_i3v%2BT2s78NG_0HH1oXOUiTOWhDdxVPBtDHKA%40mail.gmail.com

Thanks and Regards,
Shlok Kyal

Attachment Content-Type Size
v1-0001-Improve-documentation-for-pg_copy_logical_replica.patch application/octet-stream 1.2 KB

In response to

Responses

Browse pgsql-docs by date

  From Date Subject
Next Message Amit Langote 2025-02-19 07:26:33 Re: Minor suggestions for docs regarding json_table
Previous Message Peter Smith 2025-02-18 01:46:19 Re: Logical replication - initial data synchronization

Browse pgsql-hackers by date

  From Date Subject
Next Message Yuya Watari 2025-02-19 07:33:32 Re: [PoC] Reducing planning time when tables have many partitions
Previous Message Tom Lane 2025-02-19 07:06:51 Re: BUG #18815: Logical replication worker Segmentation fault