Re: Issue with logical replication slot during switchover - Mailing list pgsql-hackers

From Alexander Kukushkin
Subject Re: Issue with logical replication slot during switchover
Date
Msg-id CAFh8B=nwHPrBRe7_wECYmu-bFbDoGy+LdPxAVc-V+9Xa+USrYg@mail.gmail.com
Whole thread Raw
In response to Re: Issue with logical replication slot during switchover  (Amit Kapila <amit.kapila16@gmail.com>)
Responses Re: Issue with logical replication slot during switchover
List pgsql-hackers
Hi Amit,

On Wed, 12 Nov 2025 at 05:22, Amit Kapila <amit.kapila16@gmail.com> wrote:
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.

That's a lot of ifs, and none of them could be fulfilled in the foreseeable future.

Situation you describe is impossible.
When there is a split-brain and someone drops and re-creating logical slots with the same names on the old primary - such node can't be joined as a standby without pg_rewind.
In its current state pg_rewind wipes the pg_replslot directory, and therefore there will be no replication slots.
That is, if there is a logical replication slot with failover=true and synced=false on a healthy standby, it could have happened only because the old primary was shut down gracefully.

Regards,
--
Alexander Kukushkin

pgsql-hackers by date:

Previous
From: Yugo Nagata
Date:
Subject: Re: Make PQgetResult() not return NULL on out-of-memory error
Next
From: Xuneng Zhou
Date:
Subject: Re: Rename sync_error_count to tbl_sync_error_count in subscription statistics