Re: Issue with logical replication slot during switchover

From: Alexander Kukushkin <cyberdemn(at)gmail(dot)com>
To: Fabrice Chapuis <fabrice636861(at)gmail(dot)com>
Cc: 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-03 07:51:46
Message-ID: CAFh8B=nZYwLB78LZO+VEE3MoYKL5GXYsim_hjy1wP7k6numZ+A@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Fabrice,

On Fri, 31 Oct 2025 at 17:45, Fabrice Chapuis <fabrice636861(at)gmail(dot)com>
wrote:

> Thanks for your large analyze and explanation Alexander. If we go in the
> direction you propose and leave the option to use a suplementary flag
> allow_overwrite, may I propose you some modifications in the patch v0 you
> have attached:
>
> Why modifying this function?
>
> drop_local_obsolete_slots(List *remote_slot_list)
>

Think about the following case:
1. We have node1 (primary) and node2 (standby), with slot foo(failover=true)
2. We stop node1 for maintenance and promote node2
3. DROP replication slot on node2
4. Start node1

In this scenario the logical slot "foo" will be left unattended and it
needs to be dropped, because it doesn't exist on the primary.

As I said earlier, IMO it is only the "failover" flag that effectively
indicates the purpose of the slot. The sync flag is purely informative.

Regards,
--
Alexander Kukushkin

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Antonin Houska 2025-11-03 07:56:40 Re: Adding REPACK [concurrently]
Previous Message Bertrand Drouvot 2025-11-03 07:47:28 Re: Consistently use the XLogRecPtrIsInvalid() macro