Re: Autogenerate some wait events code and documentation - Mailing list pgsql-hackers

From Bertrand Drouvot
Subject Re: Autogenerate some wait events code and documentation
Date
Msg-id ZfgDrC5lW99sI8MM@ip-10-97-1-34.eu-west-3.compute.internal
Whole thread Raw
In response to Re: Autogenerate some wait events code and documentation  (Michael Paquier <michael@paquier.xyz>)
Responses Re: Autogenerate some wait events code and documentation
List pgsql-hackers
Hi,

On Mon, Mar 18, 2024 at 08:02:24AM +0900, Michael Paquier wrote:
> On Sun, Mar 17, 2024 at 11:31:14AM -0700, Noah Misch wrote:
> > Adding an event
> > will renumber others, which can make an extension report the wrong event until
> > recompiled.  Extensions citus, pg_bulkload, and vector refer to static events.
> > If a back-patch added WAIT_EVENT_MESSAGE_QUEUE_SOMETHING_NEW, an old-build
> > pg_bulkload report of WAIT_EVENT_PARALLEL_CREATE_INDEX_SCAN would show up in
> > pg_stat_activity as WAIT_EVENT_PARALLEL_BITMAP_SCAN.  (WAIT_EVENT_EXTENSION is
> > not part of a generated enum, fortunately.)

Nice catch, thanks!

> I see an option (4), similar to your (2) without the per-line
> annotation: add a new magic keyword like the existing "Section" that
> is used in the first lines of generate-wait_event_types.pl where we
> generate tab-separated lines with the section name as prefix of each
> line.  So I can think of something like:
> Section: ClassName - WaitEventFoo
> FOO_1    "Waiting in foo1"
> FOO_2    "Waiting in foo2"
> Backpatch:
> BAR_1    "Waiting in bar1"
> BAR_2    "Waiting in bar2"
> 
> Then force the ordering for the docs and keep the elements in the
> backpatch section at the end of the enums in the order in the txt.

Yeah I think that's a good idea.

> One thing that could make sense is to enforce that "Backpatch" is at
> the end of a section, meaning that we would need a second keyword like
> a "Section: EndBackpatch" or something like that.  That's not strictly
> necessary IMO as the format of the txt is easy to follow.

I gave it a try in the POC patch attached. I did not use a "EndBackpatch"
section to keep the perl script as simple a possible though (but documented the
expectation instead).

Regards,

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

Attachment

pgsql-hackers by date:

Previous
From: Dean Rasheed
Date:
Subject: Re: MERGE ... WHEN NOT MATCHED BY SOURCE
Next
From: Bertrand Drouvot
Date:
Subject: Re: Introduce XID age and inactive timeout based replication slot invalidation