Re: [PATCH] Two remaining shmem attachment issues in single-user mode

From: Ayush Tiwari <ayushtiwari(dot)slg01(at)gmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Cc: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>, Ashutosh Bapat <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com>
Subject: Re: [PATCH] Two remaining shmem attachment issues in single-user mode
Date: 2026-09-22 18:09:50
Message-ID: CAJTYsWViU0Biw4rNGih_OBMuE_86ANSQm5WYmnO_zYnhAFZHhA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On Sun, 20 Sept 2026 at 00:42, Ayush Tiwari <ayushtiwari(dot)slg01(at)gmail(dot)com>
wrote:
>
> Hi,
>
> I found two more shmem attachment issues in single-user mode after
> the recent fixes. Patches attached.
>
> With ShmemInitStruct(), a second call for the same name and size errors
> out with "already initialized". We only look for the old allocation if
> IsUnderPostmaster is true, so a standalone backend goes straight down
> the allocation path again.
>
> 0001 drops that condition. It fixes postmaster-startup reattachment
> too, which I did hesitate over at first. But AFAICS that was supported
> before the refactoring, and it's what the legacy API still promises.
> So I'd lean towards restoring that behaviour in both places. Is there
> a reason not to? (The size and initialization checks are still there.)
>
> The other one is a bit odd: ask for an existing area with
> SHMEM_ATTACH_UNKNOWN_SIZE after startup in single-user mode, and we
> tell you it "cannot be used during startup".
>
> IIUC, the distinction we need here is whether we're still working out
> the initial shmem requirements, not whether we have a postmaster.
> 0002 adds SRS_REQUESTING_AFTER_STARTUP for that. I couldn't see a clean
> way to reuse SRS_REQUESTING without mixing those cases up.
>
> I'm a bit on the fence about adding another state just for this.
> With the PG19 release getting close, I thought I'd send this out for
> feedback before spending more time iterating on it. Does the extra
> state seem like the right approach?

I've added this to commitfest for tracking purpose [1]

I think the first one should be an open item too for PG 19?
[haven't added it yet in that list]

Regards,
Ayush

[1] https://commitfest.postgresql.org/patch/7320/

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message surya poondla 2026-09-22 18:10:43 Re: pg_walinspect: fix LSN validation messages and empty range handling
Previous Message Sami Imseih 2026-09-22 18:01:59 REPACK (CONCURRENTLY) loses missing values of columns added without a rewrite