From: Tom Lane Date: Sat, 16 Jul 2022 16:26:19 +0000 (-0400) Subject: Remove postmaster.c's reset_shared() wrapper function. X-Git-Tag: REL_16_BETA1~2230 X-Git-Url: http://git.postgresql.org/gitweb/?a=commitdiff_plain;h=5e692dcacabd5dbc8ccfb9e37a2d26a574b6dea6;p=postgresql.git Remove postc's reset_shared() wrapper function. reset_shared just invokes CreateSharedMemoryAndSemaphores, so let's get rid of it and invoke that directly. This removes a confusing seeming-inconsistency between the postmaster's startup sequence and the startup sequence used in standalone mode. Nathan Bossart, reviewed by Pavel Borisov Discussion: https://postgr.es/m/20220329221702.GA559657@nathanxps13 --- diff --git a/src/backend/postmaster/postmaster.c b/src/backend/postmaster/postmaster.c index d7257e4056b..1c254575266 100644 --- a/src/backend/postmaster/postmaster.c +++ b/src/backend/postmaster/postmaster.c @@ -391,7 +391,6 @@ static void getInstallationPaths(const char *argv0); static void checkControlFile(void); static Port *ConnCreate(int serverFd); static void ConnFree(Port *port); -static void reset_shared(void); static void SIGHUP_handler(SIGNAL_ARGS); static void pmdie(SIGNAL_ARGS); static void reaper(SIGNAL_ARGS); @@ -1081,8 +1080,12 @@ PostmasterMain(int argc, char *argv[]) /* * Set up shared memory and semaphores. + * + * Note: if using SysV shmem and/or semas, each postmaster startup will + * normally choose the same IPC keys. This helps ensure that we will + * clean up dead IPC objects if the postmaster crashes and is restarted. */ - reset_shared(); + CreateSharedMemoryAndSemaphores(); /* * Estimate number of openable files. This must happen after setting up @@ -2723,23 +2726,6 @@ InitProcessGlobals(void) } -/* - * reset_shared -- reset shared memory and semaphores - */ -static void -reset_shared(void) -{ - /* - * Create or re-create shared memory and semaphores. - * - * Note: in each "cycle of life" we will normally assign the same IPC keys - * (if using SysV shmem and/or semas). This helps ensure that we will - * clean up dead IPC objects if the postmaster crashes and is restarted. - */ - CreateSharedMemoryAndSemaphores(); -} - - /* * SIGHUP -- reread config files, and tell children to do same */ @@ -4022,7 +4008,8 @@ PostmasterStateMachine(void) /* re-read control file into local memory */ LocalProcessControlFile(true); - reset_shared(); + /* re-create shared memory and semaphores */ + CreateSharedMemoryAndSemaphores(); StartupPID = StartupDataBase(); Assert(StartupPID != 0);