Remove postmaster.c'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
This commit is contained in:
Tom Lane 2022-07-16 12:26:19 -04:00
parent 506428d091
commit 5e692dcaca

View File

@ -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);