test_slru: Fix LWLock tranche allocation in EXEC_BACKEND builds.
Nathan Bossart <nathan@postgresql.org>
test_slru: Fix LWLock tranche allocation in EXEC_BACKEND builds. Currently, test_slru's shmem_startup_hook unconditionally generates new LWLock tranche IDs. This is fine on non-EXEC_BACKEND builds, where only the postmaster executes this hook, but on EXEC_BACKEND builds, every backend executes it, too. To fix, only generate the tranche IDs in the postmaster process by checking the IsUnderPostmaster variable. This is arguably a bug fix and could be back-patched, but since the damage is limited to some extra unused tranche IDs in a test module, I'm not going to bother. Reported-by: Sami Imseih <samimseih@gmail.com> Reviewed-by: Sami Imseih <samimseih@gmail.com> Discussion: https://postgr.es/m/CAA5RZ0vaAuonaf12CeDddQJu5xKL%2B6xVyS%2B_q1%2BcH%3D33JXV82w%40mail.gmail.com
Files
| Path | Change | +/− |
|---|---|---|
| src/test/modules/test_slru/test_slru.c | modified | +14 −6 |
Discussion
- shmem_startup_hook called twice on Windows 13 messages · 2025-08-15 → 2025-09-09