Re: failover logical replication slots - Mailing list pgsql-hackers

From Fabrice Chapuis
Subject Re: failover logical replication slots
Date
Msg-id CAA5-nLCozHs-XQpF=tVc2MOa9T96_dac77O2oJaNCTcX2g2qrw@mail.gmail.com
Whole thread Raw
In response to Re: failover logical replication slots  (Amit Kapila <amit.kapila16@gmail.com>)
Responses Re: failover logical replication slots
List pgsql-hackers

However, the problem still persists: it is currently not possible to perform an automatic switchover after creating a new subscription.

Would it be reasonable to consider adding a GUC to address this issue?
I can propose a patch in that sense if it seems appropriate.

What is your opinion

Regards,

Fabrice


On Thu, Jun 12, 2025 at 11:37 AM Amit Kapila <amit.kapila16@gmail.com> wrote:
On Thu, Jun 12, 2025 at 2:32 PM Fabrice Chapuis <fabrice636861@gmail.com> wrote:
>
> Thanks for the reply Amit,
>
> I don't really understand the logic of the implementation. If the slot name matches that of the primary slot and this slot is in failover mode, how could it be any different on the standby slot?
>

On the standby's we do allow creating logical slots (For example, one
can use pg_create_logical_replication_slot()). So, the same name slot
can be created on standby by the user before we start sync. As of now,
we don't allow setting the failover option for slots on standby's but
in future, it could be supported to allow syncing slots from standbys
(something like cascaded replication).

> After the first failover, the following failovers will work given that the sync flag is true on both the primary and standby slots.
>
> After new sandby is attached to the primary, can we imagine that when the sync worker process is started we check if a failover slot exists on the standby, if so we drop it before recreating  a new one for syncing?
>

This has the risk of dropping an unwarranted slot.

--
With Regards,
Amit Kapila.

pgsql-hackers by date:

Previous
From: Amit Kapila
Date:
Subject: Re: failover logical replication slots
Next
From: Etsuro Fujita
Date:
Subject: Re: Proposal to allow DELETE/UPDATE on partitioned tables with unsupported foreign partitions