agora inbox for pgsql-committers@postgresql.orghelp / color / mirror / Atom feed
pgsql: Fix ShmemInitStruct() reattachment in single-user mode 2+ messages / 1 participants [nested] [flat]
* pgsql: Fix ShmemInitStruct() reattachment in single-user mode @ 2026-09-24 15:22 Heikki Linnakangas <heikki.linnakangas@iki.fi> 0 siblings, 0 replies; 2+ messages in thread From: Heikki Linnakangas @ 2026-09-24 15:22 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org 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(-) ^ permalink raw reply [nested|flat] 2+ messages in thread
* pgsql: Fix ShmemInitStruct() reattachment in single-user mode @ 2026-09-24 15:22 Heikki Linnakangas <heikki.linnakangas@iki.fi> 0 siblings, 0 replies; 2+ messages in thread From: Heikki Linnakangas @ 2026-09-24 15:22 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org 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 ------ REL_19_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/9ac2cb07b44f56a9185c08dafbba0ece74e8fcab Modified Files -------------- src/backend/storage/ipc/shmem.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) ^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2026-09-24 15:22 UTC | newest] Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2026-09-24 15:22 pgsql: Fix ShmemInitStruct() reattachment in single-user mode Heikki Linnakangas <heikki.linnakangas@iki.fi> 2026-09-24 15:22 pgsql: Fix ShmemInitStruct() reattachment in single-user mode Heikki Linnakangas <heikki.linnakangas@iki.fi>
This inbox is served by agora; see mirroring instructions for how to clone and mirror all data and code used for this inbox