Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 6a1d8ce

Browse files
committed
Detach syslogger from shared memory
Commit aafc05d removed the calls to detach from shared memory from syslogger startup. That was not intentional, so put them back. Author: Rui Zhao Reviewed-by: Aleksander Alekseev Backpatch-through: 17 Discussion: https://www.postgresql.org/message-id/11505016-8cf3-4691-b996-7faed99b7877.xiyuan.zr@alibaba-inc.com
1 parent 679f940 commit 6a1d8ce

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

src/backend/postmaster/launch_backend.c

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
#include "postmaster/walwriter.h"
5454
#include "replication/slotsync.h"
5555
#include "replication/walreceiver.h"
56+
#include "storage/dsm.h"
5657
#include "storage/fd.h"
5758
#include "storage/ipc.h"
5859
#include "storage/pg_shmem.h"
@@ -219,9 +220,9 @@ PostmasterChildName(BackendType child_type)
219220
* Start a new postmaster child process.
220221
*
221222
* The child process will be restored to roughly the same state whether
222-
* EXEC_BACKEND is used or not: it will be attached to shared memory, and fds
223-
* and other resources that we've inherited from postmaster that are not
224-
* needed in a child process have been closed.
223+
* EXEC_BACKEND is used or not: it will be attached to shared memory if
224+
* appropriate, and fds and other resources that we've inherited from
225+
* postmaster that are not needed in a child process have been closed.
225226
*
226227
* 'startup_data' is an optional contiguous chunk of data that is passed to
227228
* the child process.
@@ -249,6 +250,13 @@ postmaster_child_launch(BackendType child_type,
249250
/* Detangle from postmaster */
250251
InitPostmasterChild();
251252

253+
/* Detach shared memory if not needed. */
254+
if (!child_process_kinds[child_type].shmem_attach)
255+
{
256+
dsm_detach_all();
257+
PGSharedMemoryDetach();
258+
}
259+
252260
/*
253261
* Enter the Main function with TopMemoryContext. The startup data is
254262
* allocated in PostmasterContext, so we cannot release it here yet.

0 commit comments

Comments
 (0)