From aafc05de1bf5c0324cb5e690c6742118c1ac4af6 Mon Sep 17 00:00:00 2001 From: Heikki Linnakangas Date: Mon, 18 Mar 2024 11:35:08 +0200 Subject: 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 --- src/include/replication/slotsync.h | 4 +--- src/include/replication/walreceiver.h | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) (limited to 'src/include/replication') diff --git a/src/include/replication/slotsync.h b/src/include/replication/slotsync.h index dca57c50204..61e154b31bf 100644 --- a/src/include/replication/slotsync.h +++ b/src/include/replication/slotsync.h @@ -26,9 +26,7 @@ extern PGDLLIMPORT char *PrimarySlotName; extern char *CheckAndGetDbnameFromConninfo(void); extern bool ValidateSlotSyncParams(int elevel); -#ifdef EXEC_BACKEND -extern void ReplSlotSyncWorkerMain(int argc, char *argv[]) pg_attribute_noreturn(); -#endif +extern void ReplSlotSyncWorkerMain(char *startup_data, size_t startup_data_len) pg_attribute_noreturn(); extern int StartSlotSyncWorker(void); extern void ShutDownSlotSync(void); diff --git a/src/include/replication/walreceiver.h b/src/include/replication/walreceiver.h index b906bb5ce83..12f71fa99b0 100644 --- a/src/include/replication/walreceiver.h +++ b/src/include/replication/walreceiver.h @@ -483,7 +483,7 @@ walrcv_clear_result(WalRcvExecResult *walres) } /* prototypes for functions in walreceiver.c */ -extern void WalReceiverMain(void) pg_attribute_noreturn(); +extern void WalReceiverMain(char *startup_data, size_t startup_data_len) pg_attribute_noreturn(); extern void ProcessWalRcvInterrupts(void); extern void WalRcvForceReply(void); -- cgit v1.2.3