aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2022-07-16 12:26:19 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2022-07-16 12:26:35 -0400
commit5e692dcacabd5dbc8ccfb9e37a2d26a574b6dea6 (patch)
treea9254f9e16d7796a512700d284845ffb2e047764
parent506428d091760650971433f6bc083531c307b368 (diff)
downloadpostgresql-5e692dcacabd5dbc8ccfb9e37a2d26a574b6dea6.tar.gz
postgresql-5e692dcacabd5dbc8ccfb9e37a2d26a574b6dea6.zip
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
-rw-r--r--src/backend/postmaster/postmaster.c27
1 files changed, 7 insertions, 20 deletions
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
@@ -2724,23 +2727,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
*/
static void
@@ -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);