Refactor postmaster child process launching

Heikki Linnakangas <heikki.linnakangas@iki.fi>

Commit: aafc05de1bf5c0324cb5e690c6742118c1ac4af6
Author: Heikki Linnakangas <heikki.linnakangas@iki.fi>
Date: 2024-03-18T09:35:30Z
Releases: 17.0
Refactor postmaster child process launching

Introduce new postmaster_child_launch() function that deals with the
differences in EXEC_BACKEND mode.

Refactor the mechanism of passing information from the parent to child
process. Instead of using different command-line arguments when
launching the child process in EXEC_BACKEND mode, pass a
variable-length blob of startup data along with all the global
variables. The contents of that blob depend on the kind of child
process being launched. In !EXEC_BACKEND mode, we use the same blob,
but it's simply inherited from the parent to child process.

Reviewed-by: Tristan Partin, Andres Freund
Discussion: https://www.postgresql.org/message-id/7a59b073-5b5b-151e-7ed3-8b01ff7ce9ef@iki.fi

Files

PathChange+/−
src/backend/postmaster/autovacuum.c modified +19 −134
src/backend/postmaster/auxprocess.c modified +11 −42
src/backend/postmaster/bgworker.c modified +17 −3
src/backend/postmaster/bgwriter.c modified +7 −1
src/backend/postmaster/checkpointer.c modified +7 −1
src/backend/postmaster/launch_backend.c modified +328 −104
src/backend/postmaster/pgarch.c modified +7 −1
src/backend/postmaster/postmaster.c modified +79 −438
src/backend/postmaster/startup.c modified +7 −1
src/backend/postmaster/syslogger.c modified +116 −164
src/backend/postmaster/walsummarizer.c modified +7 −1
src/backend/postmaster/walwriter.c modified +7 −1
src/backend/replication/logical/slotsync.c modified +4 −68
src/backend/replication/walreceiver.c modified +7 −1
src/backend/utils/init/globals.c modified +1 −0
src/include/postmaster/autovacuum.h modified +3 −7
src/include/postmaster/auxprocess.h modified +1 −3
src/include/postmaster/bgworker_internals.h modified +1 −1
src/include/postmaster/bgwriter.h modified +2 −2
src/include/postmaster/pgarch.h modified +1 −1
src/include/postmaster/postmaster.h modified +14 −4
src/include/postmaster/startup.h modified +1 −1
src/include/postmaster/syslogger.h modified +1 −3
src/include/postmaster/walsummarizer.h modified +1 −1
src/include/postmaster/walwriter.h modified +1 −1
src/include/replication/slotsync.h modified +1 −3
src/include/replication/walreceiver.h modified +1 −1
src/tools/pgindent/typedefs.list modified +4 −0

Discussion