pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Heikki Linnakangas <heikki.linnakangas@iki.fi>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Assign a child slot to every postmaster child process
Date: Thu, 14 Nov 2024 14:13:15 +0000
Message-ID: <E1tBaaw-001mWB-PR@gemulon.postgresql.org> (raw)

Assign a child slot to every postmaster child process

Previously, only backends, autovacuum workers, and background workers
had an entry in the PMChildFlags array. With this commit, all
postmaster child processes, including all the aux processes, have an
entry. Dead-end backends still don't get an entry, though, and other
processes that don't touch shared memory will never mark their
PMChildFlags entry as active.

We now maintain separate freelists for different kinds of child
processes. That ensures that there are always slots available for
autovacuum and background workers. Previously, pre-authentication
backends could prevent autovacuum or background workers from starting
up, by using up all the slots.

The code to manage the slots in the postmaster process is in a new
pmchild.c source file. Because postmaster.c is just so large.
Assigning pmsignal slot numbers is now pmchild.c's responsibility.
This replaces the PMChildInUse array in pmsignal.c.

Some of the comments in postmaster.c still talked about the "stats
process", but that was removed in commit 5891c7a8ed. Fix those while
we're at it.

Reviewed-by: Andres Freund <andres@anarazel.de>
Discussion: https://www.postgresql.org/message-id/a102f15f-eac4-4ff2-af02-f9ff209ec66f@iki.fi

Branch
------
master

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

Modified Files
--------------
src/backend/bootstrap/bootstrap.c           |   8 +
src/backend/postmaster/Makefile             |   1 +
src/backend/postmaster/launch_backend.c     |   3 +
src/backend/postmaster/meson.build          |   1 +
src/backend/postmaster/pmchild.c            | 285 +++++++++
src/backend/postmaster/postmaster.c         | 912 ++++++++++++----------------
src/backend/postmaster/syslogger.c          |   6 +-
src/backend/storage/ipc/pmsignal.c          |  89 +--
src/backend/storage/lmgr/proc.c             |  12 +-
src/backend/tcop/postgres.c                 |   6 +
src/include/postmaster/bgworker_internals.h |   2 +-
src/include/postmaster/postmaster.h         |  45 ++
src/include/postmaster/syslogger.h          |   2 +-
src/include/storage/pmsignal.h              |   4 +-
src/tools/pgindent/typedefs.list            |   3 +-
15 files changed, 785 insertions(+), 594 deletions(-)



Message-ID: <E1tBaaw-001mWB-PR@gemulon.postgresql.org>
Permalink:  ../E1tBaaw-001mWB-PR@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1tBaaw-001mWB-PR@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 using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: heikki.linnakangas@iki.fi, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Assign a child slot to every postmaster child process
  In-Reply-To: <E1tBaaw-001mWB-PR@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