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

From: Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>
To: Nathan Bossart <nathandbossart(at)gmail(dot)com>
Cc: 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 06:20:13
Message-ID: aH8tnX+LJoEdgjTd@ip-10-97-1-34.eu-west-3.compute.internal
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On Mon, Jul 21, 2025 at 03:28:14PM -0500, Nathan Bossart wrote:
> On Mon, Jul 21, 2025 at 03:20:55PM -0500, Nathan Bossart wrote:
> > On Fri, Jul 18, 2025 at 01:39:15PM +0000, Bertrand Drouvot wrote:
> >> +#define PG_BUILTIN_LWTRANCHE(id, name) [id] = name,
> >> +#include "storage/lwlocktranchelist.h"
> >> +#undef PG_BUILTIN_LWTRANCHE
> >
> > Why not reuse PG_LWLOCK for this?
> >
> >> + # Stop recording if we reach another section.
> >> + last if /^Section:/;
> >
> > Can we add a note to wait_event_names.txt about the required
> > ordering/matching of the non-predefined LWLocks? Otherwise, these patches
> > look pretty good to me.
>
> Something else I just thought of: could we remove the list of built-in
> tranches in lwlock.h with some macro magic that generates it from
> lwlocktranchelist.h, too?

Thanks for looking at the patch series!

Yeah, I also had in mind to auto-generate this enum list (see last sentence
in the initial email [1]) but did not think that much on how to do it and was
waiting for this patch series to go in before looking at it.

But as I like your macro idea and as you mentioned it here too, then let's do
it now: it's done in 0003 attached.

[1]: https://www.postgresql.org/message-id/aHpOgwuFQfcFMZ/B%40ip-10-97-1-34.eu-west-3.compute.internal

Regards,

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

Attachment Content-Type Size
v2-0001-Create-lwlocktranchelist.h.patch text/x-diff 8.2 KB
v2-0002-Cross-check-lists-of-predefined-tranches.patch text/x-diff 7.0 KB
v2-0003-Remove-the-list-of-built-in-tranches-in-lwlock.h.patch text/x-diff 2.7 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Bertrand Drouvot 2025-07-22 06:23:50 Re: Verify predefined LWLocks tranches have entries in wait_event_names.txt
Previous Message Michael Paquier 2025-07-22 05:54:38 Re: redis_fdw failure on crake