Re: ReplicationSlotRelease() crashes when the instance is in the single user mode

Michael Paquier <michael@paquier.xyz>

From: Michael Paquier <michael@paquier.xyz>
To: "Hayato Kuroda (Fujitsu)" <kuroda.hayato@fujitsu.com>
Cc: "'pgsql-hackers@lists.postgresql.org'" <pgsql-hackers@lists.postgresql.org>
Date: 2025-02-18T07:50:22Z
Lists: pgsql-hackers
On Tue, Feb 18, 2025 at 07:29:51AM +0000, Hayato Kuroda (Fujitsu) wrote:
> According to the original thread [1], there was a wide consensus replication-related
> operations can be rejected, except the slot removal. I feel this is reasonable.
> 
> Currently pg_drop_replication_slot() requires the droping slot can be acquired,
> so we cannot reject it in single user mode as-is. Maybe we should revive the 0002
> patch in [1] then try to do that. Thought?
> 
> [1]: https://www.postgresql.org/message-id/3b2f809f-326c-38dd-7a9e-897f957a4eb1%40enterprisedb.com

Ah, good point for the slot drop.  So 0ce5cf2ef24f is claiming that
some of these manipulations are OK.  I didn't suspect this one.

Slot advancing is a very different beast, unfortunately, that may
depend on many other subsystems.  For example with logical slots we
would finish by calling rm_decode, which could be outside of core.
Justifying that this operation is supported in single-user mode is
larger than what you are suggesting here..
--
Michael

Commits

  1. Fix assertion failure with replication slot release in single-user mode