mirror of
https://github.com/postgres/postgres.git
synced 2025-11-04 20:11:56 +03:00
Get rid of the dynamic shared memory state file.
Instead of storing the ID of the dynamic shared memory control segment in a file within the data directory, store it in the main control segment. This avoids a number of nasty corner cases, most seriously that doing an online backup and then using it on the same machine (e.g. to fire up a standby) would result in the standby clobbering all of the master's dynamic shared memory segments. Per complaints from Heikki Linnakangas, Fujii Masao, and Tom Lane.
This commit is contained in:
@@ -90,6 +90,8 @@ RequestAddinShmemSpace(Size size)
|
||||
void
|
||||
CreateSharedMemoryAndSemaphores(bool makePrivate, int port)
|
||||
{
|
||||
PGShmemHeader *shim = NULL;
|
||||
|
||||
if (!IsUnderPostmaster)
|
||||
{
|
||||
PGShmemHeader *seghdr;
|
||||
@@ -149,7 +151,7 @@ CreateSharedMemoryAndSemaphores(bool makePrivate, int port)
|
||||
/*
|
||||
* Create the shmem segment
|
||||
*/
|
||||
seghdr = PGSharedMemoryCreate(size, makePrivate, port);
|
||||
seghdr = PGSharedMemoryCreate(size, makePrivate, port, &shim);
|
||||
|
||||
InitShmemAccess(seghdr);
|
||||
|
||||
@@ -254,7 +256,7 @@ CreateSharedMemoryAndSemaphores(bool makePrivate, int port)
|
||||
|
||||
/* Initialize dynamic shared memory facilities. */
|
||||
if (!IsUnderPostmaster)
|
||||
dsm_postmaster_startup();
|
||||
dsm_postmaster_startup(shim);
|
||||
|
||||
/*
|
||||
* Now give loadable modules a chance to set up their shmem allocations
|
||||
|
||||
Reference in New Issue
Block a user