Verify predefined LWLocks tranches have entries in wait_event_names.txt

Bertrand Drouvot <bertranddrouvot.pg@gmail.com>

From: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
To: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2025-07-18T13:39:15Z
Lists: pgsql-hackers

Attachments

Hi hackers,

Some discrepancies between wait_event_names.txt and predefined LWLocks tranches
have been observed, see: a493e741d32 ,08b9b9e043b and c3623703f36.

To prevent new discrepancies from occurring, this patch series aims to $SUBJECT
(as 5b1b9bce844 did for predefined LWLocks).

The patch series contains:

0001 - Extracts the predefined LWLocks tranches from lwlock.c and puts them
in a new file (namely lwlocktranchelist.h). This way, we can include this file
in lwlock.c using the same macro pattern as we do for lwlocklist.h.

This gives us the chance to cross-check with wait_event_names.txt in
generate-lwlocknames.pl in the same way as 5b1b9bce844 did.

It's much simpler and makes more sense than having generate-lwlocknames.pl
parsing lwlock.c.

0002 - While doing changes in generate-lwlocknames.pl, I noticed that 
$continue is not used (Oversight in commit da952b415f4), so let's remove it.

0003 - Cross-check lists of predefined tranches

Same idea as 5b1b9bce844 i.e if the lists (in wait_event_names.txt and
lwlocktranchelist.h) do not match exactly, building will fail.

I wonder if once these get in, we could also generate "BuiltinTrancheIds" (in
lwlock.h) from lwlocktranchelist.h with generate-lwlocknames.pl.

Regards,

-- 
Bertrand Drouvot
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com

Commits

  1. Cross-check lists of built-in LWLock tranches.

  2. Remove unused variable in generate-lwlocknames.pl.

  3. Rework lwlocknames.txt to become lwlocklist.h