pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andres Freund <andres@anarazel.de>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: process startup: Always call Init[Auxiliary]Process() before Bas
Date: Fri, 06 Aug 2021 02:24:40 +0000
Message-ID: <E1mBpXM-0003Iu-6h@gemulon.postgresql.org> (raw)

process startup: Always call Init[Auxiliary]Process() before BaseInit().

For EXEC_BACKEND InitProcess()/InitAuxiliaryProcess() needs to have been
called well before we call BaseInit(), as SubPostmasterMain() needs LWLocks to
work. Having the order of initialization differ between platforms makes it
unnecessarily hard to understand the system and to add initialization points
for new subsystems without a lot of duplication.

To be able to change the order, BaseInit() cannot trigger
CreateSharedMemoryAndSemaphores() anymore - obviously that needs to have
happened before we can call InitProcess(). It seems cleaner to create shared
memory explicitly in single user/bootstrap mode anyway.

After this change the separation of bufmgr initialization into
InitBufferPoolAccess() / InitBufferPoolBackend() is not meaningful anymore so
the latter is removed.

Author: Andres Freund <andres@anarazel.de>
Reviewed-By: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Discussion: https://postgr.es/m/20210802164124.ufo5buo4apl6yuvs@alap3.anarazel.de

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/b406478b87e2234c0be4ca4105eee3bb466a646b

Modified Files
--------------
src/backend/bootstrap/bootstrap.c   | 18 ++++++++++--------
src/backend/postmaster/autovacuum.c | 12 ++++++------
src/backend/postmaster/auxprocess.c |  7 ++-----
src/backend/postmaster/bgworker.c   | 16 ++++++++--------
src/backend/storage/buffer/bufmgr.c | 23 +++++------------------
src/backend/tcop/postgres.c         |  8 +++++---
src/backend/utils/init/postinit.c   | 37 +++----------------------------------
src/include/storage/bufmgr.h        |  1 -
8 files changed, 39 insertions(+), 83 deletions(-)



Message-ID: <E1mBpXM-0003Iu-6h@gemulon.postgresql.org>
Permalink:  ../E1mBpXM-0003Iu-6h@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1mBpXM-0003Iu-6h@gemulon.postgresql.org

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: andres@anarazel.de
  Subject: Re: pgsql: process startup: Always call Init[Auxiliary]Process() before Bas
  In-Reply-To: <E1mBpXM-0003Iu-6h@gemulon.postgresql.org>
  References: <E1mBpXM-0003Iu-6h@gemulon.postgresql.org>

* 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