Re: Autogenerate some wait events code and documentation

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: "Drouvot, Bertrand" <bertranddrouvot(dot)pg(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
Subject: Re: Autogenerate some wait events code and documentation
Date: 2023-08-28 08:04:45
Message-ID: ZOxVHQwEC/9X/p/z@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Jul 17, 2023 at 10:16:02AM +0900, Michael Paquier wrote:
> So you mean to switch a line that now looks like that:
> WAIT_EVENT_FOO_BAR FooBar "Waiting on Foo Bar."
> To that:
> FOO_BAR "Waiting on Foo Bar."
> Or even that:
> WAIT_EVENT_FOO_BAR "Waiting on Foo Bar."
>
> Sure, it is an improvement for any wait events that use WAIT_EVENT_
> when searching them, but this adds more magic into the LWLock and Lock
> areas if the same conversion is applied there. Or am I right to
> assume that you'd mean to *not* do any of that for these two classes?
> These can be treated as exceptions in the script when generating the
> wait event names from the enum elements, of course.

I have looked again at that, and switching wait_event_names.txt to use
two columns made of the typedef definitions and the docs like is not a
problem:
FOO_BAR "Waiting on Foo Bar."

WAIT_EVENT_ is appended to the typedef definitions in the script. The
wait event names like "FooBar" are generated from the enums by
splitting using their underscores and doing some lc(). Lock and
LWLock don't need to change. This way, it is easy to grep the wait
events from the source code and match them with wait_event_names.txt.

Thoughts or comments?
--
Michael

Attachment Content-Type Size
v3-0001-Rename-wait-events-with-more-consistent-camelcase.patch text/x-diff 18.4 KB
v3-0002-Remove-column-for-wait-event-names-in-wait_event_.patch text/x-diff 52.5 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Dilip Kumar 2023-08-28 08:17:18 Re: New WAL record to detect the checkpoint redo location
Previous Message Peter Smith 2023-08-28 07:31:16 Re: [PoC] pg_upgrade: allow to upgrade publisher node