Skip to content

Commit 5e692dc

Browse files
committed
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
1 parent 506428d commit 5e692dc

File tree

1 file changed

+7
-20
lines changed

1 file changed

+7
-20
lines changed

src/backend/postmaster/postmaster.c

Lines changed: 7 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,6 @@ static void getInstallationPaths(const char *argv0);
391391
static void checkControlFile(void);
392392
static Port *ConnCreate(int serverFd);
393393
static void ConnFree(Port *port);
394-
static void reset_shared(void);
395394
static void SIGHUP_handler(SIGNAL_ARGS);
396395
static void pmdie(SIGNAL_ARGS);
397396
static void reaper(SIGNAL_ARGS);
@@ -1081,8 +1080,12 @@ PostmasterMain(int argc, char *argv[])
10811080

10821081
/*
10831082
* Set up shared memory and semaphores.
1083+
*
1084+
* Note: if using SysV shmem and/or semas, each postmaster startup will
1085+
* normally choose the same IPC keys. This helps ensure that we will
1086+
* clean up dead IPC objects if the postmaster crashes and is restarted.
10841087
*/
1085-
reset_shared();
1088+
CreateSharedMemoryAndSemaphores();
10861089

10871090
/*
10881091
* Estimate number of openable files. This must happen after setting up
@@ -2723,23 +2726,6 @@ InitProcessGlobals(void)
27232726
}
27242727

27252728

2726-
/*
2727-
* reset_shared -- reset shared memory and semaphores
2728-
*/
2729-
static void
2730-
reset_shared(void)
2731-
{
2732-
/*
2733-
* Create or re-create shared memory and semaphores.
2734-
*
2735-
* Note: in each "cycle of life" we will normally assign the same IPC keys
2736-
* (if using SysV shmem and/or semas). This helps ensure that we will
2737-
* clean up dead IPC objects if the postmaster crashes and is restarted.
2738-
*/
2739-
CreateSharedMemoryAndSemaphores();
2740-
}
2741-
2742-
27432729
/*
27442730
* SIGHUP -- reread config files, and tell children to do same
27452731
*/
@@ -4022,7 +4008,8 @@ PostmasterStateMachine(void)
40224008
/* re-read control file into local memory */
40234009
LocalProcessControlFile(true);
40244010

4025-
reset_shared();
4011+
/* re-create shared memory and semaphores */
4012+
CreateSharedMemoryAndSemaphores();
40264013

40274014
StartupPID = StartupDataBase();
40284015
Assert(StartupPID != 0);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy