Re: verify predefined LWLocks have entries in wait_event_names.txt

From: Nathan Bossart <nathandbossart(at)gmail(dot)com>
To: Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>, Michael Paquier <michael(at)paquier(dot)xyz>
Subject: Re: verify predefined LWLocks have entries in wait_event_names.txt
Date: 2024-01-05 16:42:03
Message-ID: 20240105164203.GC2168314@nathanxps13
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Thanks for reviewing.

On Fri, Jan 05, 2024 at 07:39:39AM +0000, Bertrand Drouvot wrote:
> Another option could be to create a sub-section for predefined LWLocks that are
> part of lwlocknames.txt and then sort both list (the one in the sub-section and
> the one in lwlocknames.txt). That would avoid the "must be listed in the same order"
> constraint. That said, I think the way it is done in the patch is fine because
> if one does not follow the constraint then the build would fail.

IMHO the ordering constraint makes it easier for humans to verify the lists
match.

> + die "lists of predefined LWLocks in lwlocknames.txt and wait_event_names.txt do not match"
> + unless $wait_event_lwlocks[$i] eq $lockname;
>
> What about printing $wait_event_lwlocks[$i] and $lockname in the error message?
> Something like?
>
> "
> die "lists of predefined LWLocks in lwlocknames.txt and wait_event_names.txt do not match (comparing $lockname and $wait_event_lwlocks[$i])"
> unless $wait_event_lwlocks[$i] eq $lockname;
> "
>
> I think that would give more clues for debugging purpose.

Sure, I'll add something like that. I think this particular scenario is
less likely, but that's not a reason to make the error message hard to
decipher.

--
Nathan Bossart
Amazon Web Services: https://aws.amazon.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2024-01-05 16:53:53 Re: Add new protocol message to change GUCs for usage with future protocol-only GUCs
Previous Message Nathan Bossart 2024-01-05 16:28:47 Re: Adding facility for injection points (or probe points?) for more advanced tests