shmem_startup_hook called twice on Windows - Mailing list pgsql-hackers

From Sami Imseih
Subject shmem_startup_hook called twice on Windows
Date
Msg-id CAA5RZ0vEGT1eigGbVt604LkXP6mUPMwPMxQoRCbFny44w+9EUQ@mail.gmail.com
Whole thread Raw
Responses Re: shmem_startup_hook called twice on Windows
List pgsql-hackers
Hi,

While working on a related area, I noticed that shmem_startup_hook
is called twice under EXEC_BACKEND.

The first call occurs in CreateSharedMemoryAndSemaphores() during
postmaster startup (!IsUnderPostmaster), which is expected.

The second call happens in AttachSharedMemoryStructs() (when
EXEC_BACKEND is defined), and this occurs in normal backends
(IsUnderPostmaster).

The second call does not seem correct. The startup hook that should
only run during
postmaster initialization, AFAIK.

Blame shows that this change was introduced in commit 69d903367c,
but I could not determine the rationale from the discussion,
so it may have been an oversight.

Thoughts?

--
Sami Imseih
Amazon Web Services (AWS)



pgsql-hackers by date:

Previous
From: "Burd, Greg"
Date:
Subject: Re: [PATCH] bms_prev_member() can read beyond the end of the array of allocated words
Next
From: Marthin Laubscher
Date:
Subject: About Custom Aggregates, C Extensions and Memory