agora inbox for pgsql-committers@postgresql.org  
help / color / mirror / Atom feed
From: Heikki Linnakangas <heikki.linnakangas@iki.fi>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Introduce a new mechanism for registering shared memory areas
Date: Sun, 05 Apr 2026 23:27:43 +0000
Message-ID: <E1w9WsZ-00399s-08@gemulon.postgresql.org> (raw)

Introduce a new mechanism for registering shared memory areas

This replaces the [Subsystem]ShmemSize() and [Subsystem]ShmemInit()
functions called at postmaster startup with a new set of callbacks.
The new mechanism is designed to be more ergonomic. Notably, the size
of each shmem area is specified in the same ShmemRequestStruct() call,
together with its name. The same mechanism is used in extensions,
replacing the shmem_{request/startup}_hooks.

ShmemInitStruct() and ShmemInitHash() become backwards-compatibility
wrappers around the new functions. In future commits, I will replace
all ShmemInitStruct() and ShmemInitHash() calls with the new
functions, although we'll still need to keep them around for
extensions.

Co-authored-by: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>
Reviewed-by: Matthias van de Meent <boekewurm+postgres@gmail.com>
Reviewed-by: Zsolt Parragi <zsolt.parragi@percona.com>
Reviewed-by: Robert Haas <robertmhaas@gmail.com>
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>
Discussion: https://www.postgresql.org/message-id/CAExHW5vM1bneLYfg0wGeAa=52UiJ3z4vKd3AJ72X8Fw6k3KKrg@mail.gmail...

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/283e823f9dcb03d0be720928b261628af06d3fd4

Modified Files
--------------
doc/src/sgml/system-views.sgml          |   4 +-
doc/src/sgml/xfunc.sgml                 | 158 ++++--
src/backend/bootstrap/bootstrap.c       |   2 +
src/backend/postmaster/launch_backend.c |   4 +
src/backend/postmaster/postmaster.c     |  19 +-
src/backend/storage/ipc/ipci.c          |  29 +-
src/backend/storage/ipc/shmem.c         | 824 ++++++++++++++++++++++++++++----
src/backend/storage/ipc/shmem_hash.c    |  79 ++-
src/backend/storage/lmgr/proc.c         |   3 +
src/backend/tcop/postgres.c             |  10 +-
src/backend/utils/hash/dynahash.c       |   4 +-
src/include/storage/shmem.h             | 159 +++++-
src/include/storage/shmem_internal.h    |  41 +-
src/tools/pgindent/typedefs.list        |   7 +-
14 files changed, 1144 insertions(+), 199 deletions(-)



view thread (3+ messages)  latest in thread

Message-ID: <E1w9WsZ-00399s-08@gemulon.postgresql.org>
Permalink:  ../E1w9WsZ-00399s-08@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1w9WsZ-00399s-08@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: Introduce a new mechanism for registering shared memory areas
  In-Reply-To: <E1w9WsZ-00399s-08@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 agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox