pgsql: Cross-check lists of built-in LWLock tranches.

From: Nathan Bossart <nathan(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Cross-check lists of built-in LWLock tranches.
Date: 2025-07-23 17:06:41
Message-ID: E1uecvQ-000O3Y-2y@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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(dot)pg(at)gmail(dot)com>
Reviewed-by: Michael Paquier <michael(at)paquier(dot)xyz>
Discussion: https://postgr.es/m/aHpOgwuFQfcFMZ/B%40ip-10-97-1-34.eu-west-3.compute.internal

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/2047ad068139f0b8c6da73d0b845ca9ba30fb33d

Modified Files
--------------
src/backend/storage/lmgr/generate-lwlocknames.pl | 110 +++++++++++++++++------
src/backend/storage/lmgr/lwlock.c | 48 +---------
src/backend/utils/activity/wait_event_names.txt | 10 ++-
src/include/storage/lwlock.h | 56 +++---------
src/include/storage/lwlocklist.h | 57 +++++++++++-
5 files changed, 162 insertions(+), 119 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2025-07-23 19:44:43 pgsql: Fix build breakage on Solaris-alikes with late-model GCC.
Previous Message Nathan Bossart 2025-07-23 15:30:23 pgsql: Use PqMsg_* macros in walsender.c