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
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(-)