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

From: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
To: "Zhijie Hou (Fujitsu)" <houzj(dot)fnst(at)fujitsu(dot)com>
Cc: "Hayato Kuroda (Fujitsu)" <kuroda(dot)hayato(at)fujitsu(dot)com>, Michael Paquier <michael(at)paquier(dot)xyz>, "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: ReplicationSlotRelease() crashes when the instance is in the single user mode
Date: 2025-02-20 11:31:33
Message-ID: CAA4eK1LzE2R38Xxbq-EwRs3GFOg823tg-UNoRQSXatYUaK=Nfw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Feb 20, 2025 at 4:26 PM Zhijie Hou (Fujitsu)
<houzj(dot)fnst(at)fujitsu(dot)com> wrote:
>
> On Thursday, February 20, 2025 10:23 AM Hayato Kuroda (Fujitsu) <kuroda(dot)hayato(at)fujitsu(dot)com> wrote:
> >
> > Dear Michael,
> >
> > > 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.
> >
> > > 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
>
> I'm curious about the scope of the restrictions we plan to add. For example,
> the current patch does not include checks in the functions used for consuming
> changes (such as pg_logical_slot_get_changes). Was this omission intentional?
>

Also, what about pg_replication_origin_* APIs? Do we want to restrict
those as well if we are restricting slot operations? I don't see any
solid theory presented in this thread on why we should add new checks
in multiple APIs restricting those in single-user mode.

--
With Regards,
Amit Kapila.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Ashutosh Bapat 2025-02-20 11:58:48 Re: Reducing memory consumed by RestrictInfo list translations in partitionwise join planning
Previous Message Nisha Moond 2025-02-20 11:30:48 Conflict detection for multiple_unique_conflicts in logical replication