diff options
author | Robert Haas <rhaas@postgresql.org> | 2014-04-08 11:39:55 -0400 |
---|---|---|
committer | Robert Haas <rhaas@postgresql.org> | 2014-04-08 11:39:55 -0400 |
commit | 11a65eed1637a05b03e174700799b024e104bfb4 (patch) | |
tree | c6634e65fcfc2f3eb7e86f09d18ac9562a46cb24 /src/backend/storage/ipc/ipci.c | |
parent | 0886fc6a5c75b294544263ea979b9cf6195407d9 (diff) |
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.
Diffstat (limited to 'src/backend/storage/ipc/ipci.c')
-rw-r--r-- | src/backend/storage/ipc/ipci.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/backend/storage/ipc/ipci.c b/src/backend/storage/ipc/ipci.c index c392d4fa228..4290d2dc81d 100644 --- a/src/backend/storage/ipc/ipci.c +++ b/src/backend/storage/ipc/ipci.c @@ -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 |