On Sat, Nov 15, 2025 at 4:02 AM Masahiko Sawada <sawada.mshk@gmail.com> wrote:
>
> On Fri, Nov 14, 2025 at 2:39 AM Amit Kapila <amit.kapila16@gmail.com> wrote:
> >
> >
> > The point is quite fundamental, do you think we can sync to a
> > pre-existing slot with the same name and failover marked as true after
> > the first time the node joins a new primary?
>
> Given the current behavior that we cannot create a logical slot with
> failover=true on the standby, it makes sense to me that we overwrite
> the pre-existing slot (with synced=false and failover=true) on the old
> primary by the slot (with synced=true and failover=true) on the new
> primary if their names, plugin and other properties matches and the
> pre-existing slot has lesser LSNs and XIDs than the one on the new
> primary. But at the same time, we need to consider the possible future
> changes that allow users to create a slot with failover=true also on
> the standby.
>
> Alexander pointed out[1] that allowing to create a slot with
> failover=true on the standby won't work with the current
> implementation. I agree with his analysis, and I guess we would need
> more changes than simply allowing it, regardless of accepting the
> proposed change. We might need to introduce a replication slot origin
> or a generation.
>
AFAICS, the email you pointed out wrote about use cases, not the
actual code implementation. We can discuss use cases if we want to
pursue that implementation, but the reason why we decided not to allow
it was for the cases where users try to configure cascaded standbys to
also try to sync slots from the first standby that are already being
synced from the primary. There are quite a few technical challenges in
supporting that, like how to make sure primary waits even for cascaded
standbys before sending the changes to logical subscribers.
OTOH, for the cases where there is a totally different logical slot on
standby (not present on primary) with failover=true, we can allow it
to be synced from standby-1 to a cascaded standby, though we need some
way to distinguish those cases. For example, during sync on cascaded
standby, we can ensure that the slot being synced is not a sync-slot
(failover=true and sync=true).
--
With Regards,
Amit Kapila.