public inbox for [email protected]
help / color / mirror / Atom feedFrom: Drouvot, Bertrand <[email protected]>
To: Michael Paquier <[email protected]>
To: Andres Freund <[email protected]>
Cc: PostgreSQL Hackers <[email protected]>
Subject: Re: Autogenerate some wait events code and documentation
Date: Sun, 9 Jul 2023 09:15:34 +0200
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>
<ZGWrTn//[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
<ZKTN//[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
Hi,
On 7/9/23 6:32 AM, Michael Paquier wrote:
> On Fri, Jul 07, 2023 at 01:49:24PM +0900, Michael Paquier wrote:
>> Hmm. If we go down this road I would make the choice of simplicity
>> and remove entirely a column, then, generating the snakecase from the
>> camelcase or vice-versa (say like a $string =~ s/([a-z]+)/$1_/g;),
>> even if it means having slightly incompatible strings showing to the
>> users. And I'd rather minimize the number of exceptions we need to
>> handle in this automation (aka no exception rules for some keywords
>> like "SSL" or "WAL", etc.).
>
> After pondering more about that, the attached patch set does exactly
> that.
Thanks!
> Patch 0001 includes an update of the wait event names so as
> these are more consistent with the enum elements generated. With this
> change, users can apply lower() or upper() across monitoring queries
> and still get the same results as before. An exception was the
> message queue events, which the enums used "MQ" but the event names
> used "MessageQueue", but this concerns only four lines of code in the
> backend. The newly-generated enum elements match with the existing
> ones, except for MQ.
>
> Patch 0002 introduces a set of simplifications for the format of
> wait_event_names.txt:
> - Removal of the first column for the enums.
> - Removal of the quotes for the event name. We have a single keyword
> for these, so that's kind of annoying to cope with that for new
> entries.
> - Build of the enum elements using the event names, by applying a
> rebuild as simple as that:
> + $waiteventenumname =~ s/([a-z])([A-Z])/$1_$2/g;
> + $waiteventenumname = uc($waiteventenumname);
>
> Thoughts?
That's great and it does simplify the wait_event_names.txt format (and the
impact on "MQ" does not seem like a big deal).
I also noticed that you now provide the culprit line in case of parsing
failure (thanks for that).
#
-# "C symbol in enums" "format in the system views" "description in the docs"
+# "format in the system views" "description in the docs"
Should we add a note here about the impact of the "format in the system views" on
the auto generated enum? (aka how it is generated based on its format)?
Regards,
--
Bertrand Drouvot
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com
view thread (32+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected], [email protected], [email protected]
Subject: Re: Autogenerate some wait events code and documentation
In-Reply-To: <[email protected]>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox