Re: Verify predefined LWLocks tranches have entries in wait_event_names.txt

From: Nathan Bossart <nathandbossart(at)gmail(dot)com>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Verify predefined LWLocks tranches have entries in wait_event_names.txt
Date: 2025-07-22 01:34:41
Message-ID: aH7qsdN7s6eqHTcn@nathan
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Jul 22, 2025 at 08:02:52AM +0900, Michael Paquier wrote:
> Ah, you mean removing the need to have to maintain BuiltinTrancheIds.
> This structure depends on NUM_INDIVIDUAL_LWLOCKS for the start value.
> Not really an objection per-se, but trying to automate everything may
> impact the readability of this area of the code.

I bet we could maintain a decent level of readability with some extra
commentary. IMHO it's worth it to avoid maintaining duplicate lists. But
that's not something I feel terribly strong about, if others disagree.
FWIW I was imagining something like this:

typedef enum BuiltinTrancheIds
{
LWTRANCHE_INVALID = NUM_INDIVIDUAL_LWLOCKS - 1,
#define PG_BUILTIN_LWTRANCHE(id, name) id,
#include "storage/lwlocktranchelist.h"
#undef PG_BUILTIN_LWTRANCHE
LWTRANCHE_FIRST_USER_DEFINED,
} BuiltinTrancheIds;

--
nathan

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2025-07-22 01:37:05 Re: teach pg_upgrade to handle in-place tablespaces
Previous Message David Rowley 2025-07-22 01:29:43 Re: Support tid range scan in parallel?