mirror of
https://github.com/postgres/postgres.git
synced 2025-07-02 09:02:37 +03:00
Create a "shmem_startup_hook" to be called at the end of shared memory
initialization, to give loadable modules a reasonable place to perform creation of any shared memory areas they need. This is the logical conclusion of our previous creation of RequestAddinShmemSpace() and RequestAddinLWLocks(). We don't need an explicit shmem_shutdown_hook, because the existing on_shmem_exit and on_proc_exit mechanisms serve that need. Also, adjust SubPostmasterMain so that libraries that got loaded into the postmaster will be loaded into all child processes, not only regular backends. This improves consistency with the non-EXEC_BACKEND behavior, and might be necessary for functionality for some types of add-ons.
This commit is contained in:
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/storage/ipc/ipci.c,v 1.98 2009/01/01 17:23:47 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/storage/ipc/ipci.c,v 1.99 2009/01/03 17:08:39 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -34,6 +34,8 @@
|
||||
#include "storage/spin.h"
|
||||
|
||||
|
||||
shmem_startup_hook_type shmem_startup_hook = NULL;
|
||||
|
||||
static Size total_addin_request = 0;
|
||||
static bool addin_request_allowed = true;
|
||||
|
||||
@ -222,4 +224,10 @@ CreateSharedMemoryAndSemaphores(bool makePrivate, int port)
|
||||
if (!IsUnderPostmaster)
|
||||
ShmemBackendArrayAllocation();
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Now give loadable modules a chance to set up their shmem allocations
|
||||
*/
|
||||
if (shmem_startup_hook)
|
||||
shmem_startup_hook();
|
||||
}
|
||||
|
Reference in New Issue
Block a user