pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Nathan Bossart <nathandbossart@gmail.com>
To: pgsql-hackers@postgresql.org
Subject: remove reset_shared()
Date: Tue, 29 Mar 2022 15:17:02 -0700
Message-ID: <20220329221702.GA559657@nathanxps13> (raw)

Hi hackers,

Is there any reason to keep reset_shared() around anymore?  It is now just
a wrapper function for CreateSharedMemoryAndSemaphores(), and AFAICT the
information in the comments is already covered by comments in the shared
memory code.  I think it's arguable that the name of the function makes it
clear that it might recreate the shared memory, but if that is a concern,
perhaps we could rename the function to something like
CreateOrRecreateSharedMemoryAndSemaphores().

I've attached a patch that simply removes this wrapper function.  This is
admittedly just nitpicking, so I don't intend to carry this patch further
if anyone is opposed.

-- 
Nathan Bossart
Amazon Web Services: https://aws.amazon.com

Attachments:

v1-0001-Remove-reset_shared.patch (text/x-diff, 2.1K) download From 295e1e93a2ff4e655e85040d931c0d332d14b5bd Mon Sep 17 00:00:00 2001 From: Nathan Bossart <nathandbossart@gmail.com> Date: Tue, 29 Mar 2022 14:56:47 -0700 Subject: [PATCH v1 1/1] Remove reset_shared(). This is now just a wrapper for CreateSharedMemoryAndSemaphores(), and the information in the comments is already covered by comments in the shared memory code. --- src/backend/postmaster/postmaster.c | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-) diff --git a/src/backend/postmaster/postmaster.c b/src/backend/postmaster/postmaster.c index 80bb269599..f62d12e74a 100644 --- a/src/backend/postmaster/postmaster.c +++ b/src/backend/postmaster/postmaster.c @@ -399,7 +399,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); @@ -1072,7 +1071,7 @@ PostmasterMain(int argc, char *argv[]) /* * Set up shared memory and semaphores. */ - reset_shared(); + CreateSharedMemoryAndSemaphores(); /* * Estimate number of openable files. This must happen after setting up @@ -2736,23 +2735,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 */ @@ -4109,7 +4091,7 @@ PostmasterStateMachine(void) /* re-read control file into local memory */ LocalProcessControlFile(true); - reset_shared(); + CreateSharedMemoryAndSemaphores(); StartupPID = StartupDataBase(); Assert(StartupPID != 0); -- 2.25.1

view thread (6+ messages)  latest in thread

Message-ID: <20220329221702.GA559657@nathanxps13>
Permalink:  ../20220329221702.GA559657@nathanxps13/
Also on:    postgresql.org/message-id/20220329221702.GA559657@nathanxps13

 ·  · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: nathandbossart@gmail.com
  Subject: Re: remove reset_shared()
  In-Reply-To: <20220329221702.GA559657@nathanxps13>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox