pgsql: Move shmem allocator's fields from PGShmemHeader to its own stru - Mailing list pgsql-committers

From Heikki Linnakangas
Subject pgsql: Move shmem allocator's fields from PGShmemHeader to its own stru
Date
Msg-id E1vlrKp-000BTA-2T@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
Move shmem allocator's fields from PGShmemHeader to its own struct

For readability. It was a slight modularity violation to have fields
in PGShmemHeader that were only used by the allocator code in
shmem.c. And it was inconsistent that ShmemLock was nevertheless not
stored there. Moving all the allocator-related fields to a separate
struct makes it more consistent and modular, and removes the need to
allocate and pass ShmemLock separately via BackendParameters.

Merge InitShmemAccess() and InitShmemAllocation() into a single
function that initializes the struct when called from postmaster, and
when called from backends in EXEC_BACKEND mode, re-establishes the
global variables. That's similar to all the *ShmemInit() functions
that we have.

Co-authored-by: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>
Discussion: https://www.postgresql.org/message-id/CAExHW5uNRB9oT4pdo54qAo025MXFX4MfYrD9K15OCqe-ExnNvg@mail.gmail.com

Branch
------
master

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

Modified Files
--------------
src/backend/port/sysv_shmem.c           |   2 +-
src/backend/port/win32_shmem.c          |   2 +-
src/backend/postmaster/launch_backend.c |   7 +-
src/backend/storage/ipc/ipci.c          |   4 +-
src/backend/storage/ipc/shmem.c         | 163 +++++++++++++++-----------------
src/include/storage/pg_shmem.h          |   4 +-
src/include/storage/shmem.h             |   3 +-
src/tools/pgindent/typedefs.list        |   1 +
8 files changed, 83 insertions(+), 103 deletions(-)


pgsql-committers by date:

Previous
From: Álvaro Herrera
Date:
Subject: pgsql: Minor cosmetic tweaks
Next
From: Tom Lane
Date:
Subject: pgsql: Make psql/t/030_pager.pl more robust.