Re: shmem_startup_hook called twice on Windows
От | Sami Imseih |
---|---|
Тема | Re: shmem_startup_hook called twice on Windows |
Дата | |
Msg-id | CAA5RZ0t0qbTT5y6O7kCRh3pvgTOAh8sDe=Z+uQK2+g8HBGmdnw@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: shmem_startup_hook called twice on Windows (Nathan Bossart <nathandbossart@gmail.com>) |
Ответы |
Re: shmem_startup_hook called twice on Windows
|
Список | pgsql-hackers |
> 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. I think the startup hook must run in each backend for EXEC_BACKEND, else we won't properly initialize pointers to shared memory in that case, right? I guess the doc below is giving a vague warning that one should be careful what they put in that hook. > I added the following wording in commit 964152c: > IIUC commit 69d9033 actually makes that inaccurate for the non-EXEC_BACKEND > case. Presumably this is okay because we don't need to re-initialize > pointers to shmem when forking. I must've missed this change when updating > the documentation. Thanks, I missed the doc update. Yes, that is inconsistent between platforms, and if we must live with this behavior, should the doc give a bigger warning about the code that goes in that hook? -- Sami
В списке pgsql-hackers по дате отправления: