agora inbox for pgsql-committers@postgresql.org
help / color / mirror / Atom feedFrom: Heikki Linnakangas <heikki.linnakangas@iki.fi>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix ShmemInitStruct() reattachment in single-user mode
Date: Thu, 24 Sep 2026 15:22:11 +0000
Message-ID: <E1x9lH1-000000014n5-3qfA@gemulon.postgresql.org> (raw)
Fix ShmemInitStruct() reattachment in single-user mode
ShmemInitStruct() only looked for an existing allocation when
IsUnderPostmaster was true. Because of that, you could not reattach
to an existing shmem area in a standalone backend.
Usually, you only call ShmemInitStruct() for the same shmem area once
in a process and hold onto the returned pointer, but there was no rule
that you couldn't call it twice for the same area if you wanted to,
and before commit 283e823f9d, it worked. To fix, check for an
existing allocation regardless of process type, like the old
implementation did.
Author: Ayush Tiwari <ayushtiwari.slg01@gmail.com>
Reviewed-by: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>
Discusssion: https://www.postgresql.org/message-id/CAJTYsWXREGXCnWdZJsXt8pT2UY_Y2GSx+HOUu2X3s8YDCLj0_A@mail.gmail...
Backpatch-through: 19
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/4e277b424a5312cdee468d92078a5359f3e7d4e7
Modified Files
--------------
src/backend/storage/ipc/shmem.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
view thread (2+ messages) latest in thread
Message-ID: <E1x9lH1-000000014n5-3qfA@gemulon.postgresql.org>
Permalink: ../E1x9lH1-000000014n5-3qfA@gemulon.postgresql.org/
Also on: postgresql.org/message-id/E1x9lH1-000000014n5-3qfA@gemulon.postgresql.org
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-committers@postgresql.org
Cc: heikki.linnakangas@iki.fi, pgsql-committers@lists.postgresql.org
Subject: Re: pgsql: Fix ShmemInitStruct() reattachment in single-user mode
In-Reply-To: <E1x9lH1-000000014n5-3qfA@gemulon.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox