Re: ReplicationSlotRelease() crashes when the instance is in the single user mode
Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
From: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
To: "Hayato Kuroda (Fujitsu)" <kuroda.hayato@fujitsu.com>
Cc: 'Michael Paquier' <michael@paquier.xyz>, "'pgsql-hackers@lists.postgresql.org'" <pgsql-hackers@lists.postgresql.org>
Date: 2025-02-20T10:29:56Z
Lists: pgsql-hackers
Hi, On Thu, Feb 20, 2025 at 02:22:41AM +0000, Hayato Kuroda (Fujitsu) wrote: > Dear Michael, > Thanks for the report and the patch! > > I did not check how these call behave individually, just a few > > comments while putting my eyes on the patch. > > > > + if (!IsUnderPostmaster) > > + elog(ERROR, > > + "slot operation is prohibited in the single user mode"); > > > > elog() should not be used for failures that can be user-facing as this > > would not provide any translation. > > I intentionally used elog() because I thought single user mode is not user-facing. > But it is OK for me to use ereport() instead. Yeah, I think it's also about using ereport for cases that we think can happen ( and so needs to be translated). In this case, it clearly can happen so ereport() is better. > > I'd suggest rewording the error message to provide some more context, > > as well, say: > > "cannot use %s in single-user mode", "function_name" > > Fixed. PSA new version === 1 Nit: "cannot use function %s in single-user mode", "function_name"" maybe? (that would somehow match the existing ""user-defined types cannot use subscripting function %s") === 2 + "pg_copy_replication_slot"))); s/pg_copy_replication_slot/copy_replication_slot/ maybe? As it is the function that would report the error actually (could be called from pg_copy_logical_replication_slot_[a|b|c] and pg_copy_physical_replication_slot_[a|b] though). Regards, -- Bertrand Drouvot PostgreSQL Contributors Team RDS Open Source Databases Amazon Web Services: https://aws.amazon.com
Commits
-
Fix assertion failure with replication slot release in single-user mode
- 8ed079cad824 13.23 landed
- 32d388d00f9f 14.20 landed
- 818be9b73c94 15.15 landed
- fea1cc3f75ff 16.11 landed
- 07a302387176 17.7 landed
- ea1c6b0b0aec 18.0 landed
- 1f2e51e3c7c2 19 (unreleased) landed