Add a test module to test after-startup shmem allocations
Heikki Linnakangas <heikki.linnakangas@iki.fi>
Author:
Heikki Linnakangas <heikki.linnakangas@iki.fi>
Date: 2026-04-05T23:12:51Z
Releases:
19 (unreleased)
Add a test module to test after-startup shmem allocations
The old ShmemInit{Struct/Hash}() functions could be used after
postmaster statup, as long as the allocation is small enough to fit in
spare shmem reserved at startup. I believe some extensions do that,
although we hadn't really documented it and had not coverage for it.
The new test module covers that after-startup usage with the new
ShmemRequestStruct() functions.
Reviewed-by: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>
Reviewed-by: Matthias van de Meent <boekewurm+postgres@gmail.com>
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>
Discussion: https://www.postgresql.org/message-id/CAExHW5vM1bneLYfg0wGeAa=52UiJ3z4vKd3AJ72X8Fw6k3KKrg@mail.gmail.com
Files
| Path | Change | +/− |
|---|---|---|
| src/test/modules/Makefile | modified | +1 −0 |
| src/test/modules/meson.build | modified | +1 −0 |
| src/test/modules/test_shmem/Makefile | added | +24 −0 |
| src/test/modules/test_shmem/meson.build | added | +33 −0 |
| src/test/modules/test_shmem/t/001_late_shmem_alloc.pl | added | +49 −0 |
| src/test/modules/test_shmem/test_shmem--1.0.sql | added | +9 −0 |
| src/test/modules/test_shmem/test_shmem.c | added | +101 −0 |
| src/test/modules/test_shmem/test_shmem.control | added | +3 −0 |
| src/tools/pgindent/typedefs.list | modified | +1 −0 |
Discussion
- Better shared data structure management and resizable shared data structures 87 messages · 2026-02-13 → 2026-06-15