diff options
author | Heikki Linnakangas <heikki.linnakangas@iki.fi> | 2024-07-29 22:21:34 +0300 |
---|---|---|
committer | Heikki Linnakangas <heikki.linnakangas@iki.fi> | 2024-07-29 22:42:15 +0300 |
commit | f208a16035fc5d18cee0e7e2fbf176616905f9b0 (patch) | |
tree | b6eb1515ed03cae1b495aabe5114de2707e09dbe /src/backend/postmaster/launch_backend.c | |
parent | 81db073a287842cbf0a17cb32108b214a335670b (diff) |
Detach syslogger from shared memory
Commit aafc05de1b 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
Diffstat (limited to 'src/backend/postmaster/launch_backend.c')
-rw-r--r-- | src/backend/postmaster/launch_backend.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/backend/postmaster/launch_backend.c b/src/backend/postmaster/launch_backend.c index bdf490c31d0..d23aed237d2 100644 --- a/src/backend/postmaster/launch_backend.c +++ b/src/backend/postmaster/launch_backend.c @@ -53,6 +53,7 @@ #include "postmaster/walwriter.h" #include "replication/slotsync.h" #include "replication/walreceiver.h" +#include "storage/dsm.h" #include "storage/fd.h" #include "storage/ipc.h" #include "storage/pg_shmem.h" @@ -219,9 +220,9 @@ PostmasterChildName(BackendType child_type) * Start a new postmaster child process. * * The child process will be restored to roughly the same state whether - * EXEC_BACKEND is used or not: it will be attached to shared memory, and fds - * and other resources that we've inherited from postmaster that are not - * needed in a child process have been closed. + * EXEC_BACKEND is used or not: it will be attached to shared memory if + * appropriate, and fds and other resources that we've inherited from + * postmaster that are not needed in a child process have been closed. * * 'startup_data' is an optional contiguous chunk of data that is passed to * the child process. @@ -249,6 +250,13 @@ postmaster_child_launch(BackendType child_type, /* Detangle from postmaster */ InitPostmasterChild(); + /* Detach shared memory if not needed. */ + if (!child_process_kinds[child_type].shmem_attach) + { + dsm_detach_all(); + PGSharedMemoryDetach(); + } + /* * Enter the Main function with TopMemoryContext. The startup data is * allocated in PostmasterContext, so we cannot release it here yet. |