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

From: "Hayato Kuroda (Fujitsu)" <kuroda(dot)hayato(at)fujitsu(dot)com>
To: 'Michael Paquier' <michael(at)paquier(dot)xyz>
Cc: 'Paul A Jungwirth' <pj(at)illuminatedcomputing(dot)com>, Mutaamba Maasha <maasha(at)gmail(dot)com>, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, "Zhijie Hou (Fujitsu)" <houzj(dot)fnst(at)fujitsu(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>, "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-08-19 10:26:22
Message-ID: OSCPR01MB14966D87D8EB0D9CD32C6A43DF530A@OSCPR01MB14966.jpnprd01.prod.outlook.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Dear Michael, Paul, Mutaamba,

> FWIW, I had my doubts at the beginning on the thread about the
> use-case, but after re-reading the whole thing I am going to side with
> Robert's opinion that if a fix to authorize some of the operations is
> simple, then let's just authorize the case(s) and have the fix.

OK, thanks for the clarification. Let's focus on 0001 now.

> Echoing with Paul, what I find as critically lacking from the proposed
> patches are regression tests to check and validate the behaviors you
> are looking for in the patches. Please add some in the shape of perl
> commands that use direct --single commands of postgres. We have cases
> that do so currently in the tree: sepgsql and shm. I don't see a
> reason why we could not do that as well here with run_log(). It is
> also possible to pass a -c exit_on_error=true to force failures.
>
> Not having a test for the single-user case of a slot drop is of course
> something that we are lacking now. As we are playing with this area
> of the code, let's add something for this case as well.

I added a first version of the test. It could work on my env (Linux).
Since I cannot come up the appropriate place, I introduced new test file in
recovery test. creating/dropping/advancing a slot, and doing a logical decoding
is tested. Since standby mode is not supported by the single-user instance,
I did not test the slot synchronization. I have not known that.

0002 was updated accordingly just in case. In the patch some functions were expected
to fail. Also, a check for pg_sync_replication_slots() was removed because we cannot call
the function in the first place.

IIUC, 0001 can be backpatched for all supported branches. I will create for them
after patch would be a good shape.

Best regards,
Hayato Kuroda
FUJITSU LIMITED

Attachment Content-Type Size
v6-0001-Set-ReplicationSlot-active_pid-even-in-single-use.patch application/octet-stream 3.6 KB
v6-0002-Prohibit-slot-manipulation-while-in-single-user-m.patch application/octet-stream 8.4 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Julien Rouhaud 2025-08-19 10:46:56 Re: Proposal: Extending the PostgreSQL Protocol with Command Metadata
Previous Message Fujii Masao 2025-08-19 10:08:37 Re: New commitfest app release on August 19th