Re: Autogenerate some wait events code and documentation
Michael Paquier <michael@paquier.xyz>
From: Michael Paquier <michael@paquier.xyz>
To: Andres Freund <andres@anarazel.de>
Cc: "Drouvot, Bertrand" <bertranddrouvot.pg@gmail.com>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2023-07-09T04:32:47Z
Lists: pgsql-hackers
Attachments
- 0001-Rename-wait-events-with-more-consistent-camelcase-st.patch (text/x-diff) patch 0001
- 0002-Simplify-format-of-wait_event_names.txt.patch (text/x-diff) patch 0002
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. 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? -- Michael
Commits
-
Add "ABI_compatibility" regions to wait_event_names.txt
- f98dbdeb51d1 17.0 landed
-
Remove column for wait event names in wait_event_names.txt
- 59cbf60c0f2b 17.0 landed
-
Use more consistent names for wait event objects and types
- 414f6c0fb79a 17.0 landed
-
Add information about line contents on parsing failure of wait_event_names.txt
- aea7fe33fb6a 17.0 landed
-
Remove double quotes from the second column of wait_event_names.txt
- 183a60a628fe 17.0 landed
-
Generate automatically code and documentation related to wait events
- fa88928470b5 17.0 landed
-
Refactor some code related to wait events "BufferPin" and "Extension"
- 2aeaf80e578e 17.0 landed
-
doc: Fix ordering of entries in wait event table for I/O type
- 44e977d7ecb9 16.0 landed