Cross-check lists of built-in LWLock tranches.
Nathan Bossart <nathan@postgresql.org>
Cross-check lists of built-in LWLock tranches.
lwlock.c, lwlock.h, and wait_event_names.txt each contain a list of
built-in LWLock tranches. It is easy to miss one or the other when
adding or removing tranches, and discrepancies have adverse effects
(e.g., breaking JOINs between pg_stat_activity and pg_wait_events).
This commit moves the lists of built-in tranches in lwlock.{c,h} to
lwlocklist.h and adds a cross-check to the script that generates
lwlocknames.h. If the lists do not match exactly, building will
fail.
Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Discussion: https://postgr.es/m/aHpOgwuFQfcFMZ/B%40ip-10-97-1-34.eu-west-3.compute.internal
Files
| Path | Change | +/− |
|---|---|---|
| src/backend/storage/lmgr/generate-lwlocknames.pl | modified | +83 −27 |
| src/backend/storage/lmgr/lwlock.c | modified | +4 −44 |
| src/backend/utils/activity/wait_event_names.txt | modified | +7 −3 |
| src/include/storage/lwlock.h | modified | +14 −42 |
| src/include/storage/lwlocklist.h | modified | +54 −3 |
Discussion
- Verify predefined LWLocks tranches have entries in wait_event_names.txt 13 messages · 2025-07-18 → 2025-07-23