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 <[email protected]> Reviewed-by: Ashutosh Bapat <[email protected]> Discusssion: https://www.postgresql.org/message-id/cajtyswxregxcnwdzjsxt8pt2uy_y2gsx+houu2x3s8ydclj...@mail.gmail.com 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(-)
