Re: Issue with logical replication slot during switchover

From: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
To: Fabrice Chapuis <fabrice636861(at)gmail(dot)com>
Cc: Alexander Kukushkin <cyberdemn(at)gmail(dot)com>, shveta malik <shveta(dot)malik(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Shlok Kyal <shlok(dot)kyal(dot)oss(at)gmail(dot)com>
Subject: Re: Issue with logical replication slot during switchover
Date: 2025-11-12 04:22:09
Message-ID: CAA4eK1LhogAeNQE5yy04oK+Lx_tXGRkjmcmpcQT2c-d6Yj1gRg@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Nov 11, 2025 at 9:27 PM Fabrice Chapuis <fabrice636861(at)gmail(dot)com> wrote:
>
> if I resume your scenario
> 1. A standby S has a failover slot slot1 synchronized with slot1 on primary P
> 2. We promote S
> 3. On P we drop slot1 and create slot1 again with failover mode (a subscriber exist on another instance by example)
> 4. A rewind is performed on P the former primary to rejoin S the former standby
> 5. On P slot1 is automatically dropped and recreated to be synchronized
>
> In which context this kind of scenario could happend?
>

It is difficult to tell when this can happen but you detailed there is
a theoretical possibility of the same. If we had an in-core cluster
tool that manages nodes on its own which doesn't allow such scenarios
to happen then we could possibly say that using such a tool it is safe
to overwrite old primary's slots.

> Isn't the goal to find a solution for a switchover which is carried out for maintenance on a Postgres cluster, the aim is to find a compromise to cover the most likely scenarios.
>

Yes, that is why I thought of providing some form of UI that can allow
outside cluster solutions to manage such slots.

> Do you think we must come back to the allow_overwrite flag approach or another solution?
>

We can wait for a few days to see what others think on this matter.

--
With Regards,
Amit Kapila.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message vignesh C 2025-11-12 04:23:56 Rename sync_error_count to tbl_sync_error_count in subscription statistics
Previous Message Thomas Munro 2025-11-12 04:11:39 Re: Trying out read streams in pgvector (an extension)