]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Introduce a new mechanism for registering shared memory areas
authorHeikki Linnakangas <heikki.linnakangas@iki.fi>
Sun, 5 Apr 2026 23:12:50 +0000 (02:12 +0300)
committerHeikki Linnakangas <heikki.linnakangas@iki.fi>
Sun, 5 Apr 2026 23:12:50 +0000 (02:12 +0300)
commit283e823f9dcb03d0be720928b261628af06d3fd4
tree9ec265991500dde057d230009c8fde455262d14b
parent6ef9bee29310fa519b1b0f01221fcf1c41a33679
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.com
14 files changed:
doc/src/sgml/system-views.sgml
doc/src/sgml/xfunc.sgml
src/backend/bootstrap/bootstrap.c
src/backend/postmaster/launch_backend.c
src/backend/postmaster/postmaster.c
src/backend/storage/ipc/ipci.c
src/backend/storage/ipc/shmem.c
src/backend/storage/ipc/shmem_hash.c
src/backend/storage/lmgr/proc.c
src/backend/tcop/postgres.c
src/backend/utils/hash/dynahash.c
src/include/storage/shmem.h
src/include/storage/shmem_internal.h
src/tools/pgindent/typedefs.list