pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Generate automatically code and documentation related to wait ev
5+ messages / 2 participants
[nested] [flat]

Commits from this thread:
  2023-10-19 7fb355db14  Install wait_event_types.h in VPATH builds
* pgsql: Generate automatically code and documentation related to wait ev
@ 2023-07-05 01:55  Michael Paquier <michael@paquier.xyz>
  0 siblings, 1 reply; 5+ messages in thread

From: Michael Paquier @ 2023-07-05 01:55 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Generate automatically code and documentation related to wait events

The documentation and the code is generated automatically from a new
file called wait_event_names.txt, formatted in sections dedicated to
each wait event class (Timeout, Lock, IO, etc.) with three tab-separated
fields:
- C symbol in enums
- Format in the system views
- Description in the docs

Using this approach has several advantages, as we have proved to be
rather bad in maintaining this area of the tree across the years:
- The order of each item in the documentation and the code, which should
be alphabetical, has become incorrect multiple times, and the script
generating the code and documentation has a few rules to enforce that,
making the maintenance a no-brainer.
- Some wait events were added to the code, but not documented, so this
cannot be missed now.
- The order of the tables for each wait event class is enforced in the
documentation (the input .txt file does so as well for clarity, though
this is not mandatory).
- Less code, shaving 1.2k lines from the tree, with 1/3 of the savings
coming from the code, the rest from the documentation.

The wait event types "Lock" and "LWLock" still have their own code path
for their code, hence only the documentation is created for them.  These
classes are listed with a special marker called WAIT_EVENT_DOCONLY in
the input file.

Adding a new wait event now requires only an update of
wait_event_names.txt, with "Lock" and "LWLock" treated as exceptions.

This commit has been tested with configure/Makefile, the CI and VPATH
build.  clean, distclean and maintainer-clean were working fine.

Author: Bertrand Drouvot, Michael Paquier
Discussion: https://postgr.es/m/77a86b3a-c4a8-5f5d-69b9-d70bbf2e9b98@gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/fa88928470b538c0ec0289e4d69ee12356c5a8ce

Modified Files
--------------
doc/src/sgml/.gitignore                            |    1 +
doc/src/sgml/Makefile                              |    4 +-
doc/src/sgml/filelist.sgml                         |    1 +
doc/src/sgml/meson.build                           |   12 +
doc/src/sgml/monitoring.sgml                       | 1271 +-------------------
src/backend/Makefile                               |   13 +-
src/backend/storage/lmgr/lwlocknames.txt           |    4 +-
src/backend/utils/activity/.gitignore              |    2 +
src/backend/utils/activity/Makefile                |   12 +
.../utils/activity/generate-wait_event_types.pl    |  263 ++++
src/backend/utils/activity/meson.build             |   14 +
src/backend/utils/activity/wait_event.c            |  611 +---------
src/backend/utils/activity/wait_event_names.txt    |  371 ++++++
src/backend/utils/adt/lockfuncs.c                  |    3 +-
src/common/meson.build                             |    7 +-
src/include/Makefile                               |    2 +-
src/include/utils/.gitignore                       |    1 +
src/include/utils/meson.build                      |   19 +
src/include/utils/wait_event.h                     |  232 +---
src/test/ssl/t/002_scram.pl                        |    3 +-
src/tools/msvc/Solution.pm                         |   19 +
src/tools/msvc/clean.bat                           |    3 +
22 files changed, 757 insertions(+), 2111 deletions(-)



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: pgsql: Generate automatically code and documentation related to wait ev
@ 2023-10-18 15:59  Christoph Berg <myon@debian.org>
  parent: Michael Paquier <michael@paquier.xyz>
  0 siblings, 1 reply; 5+ messages in thread

From: Christoph Berg @ 2023-10-18 15:59 UTC (permalink / raw)
  To: Michael Paquier <michael@paquier.xyz>; +Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>

Re: Michael Paquier
> Generate automatically code and documentation related to wait events

Hi,

I'm not entirely sure this is the commit to blame, but it's certainly
close:

A Debian user is complaining that in PG17, the installed
/usr/include/postgresql/17/server/utils/wait_event.h file is
referencing utils/wait_event_types.h, but that file doesn't get
installed by the (autoconf) build sytem.

See
https://pgdgbuild.dus.dg-i.net/job/postgresql-17-binaries-snapshot/242/architecture=amd64,distributi...
for a build log with file listings near the end.

Christoph





^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: pgsql: Generate automatically code and documentation related to wait ev
@ 2023-10-18 23:45  Michael Paquier <michael@paquier.xyz>
  parent: Christoph Berg <myon@debian.org>
  0 siblings, 1 reply; 5+ messages in thread

From: Michael Paquier @ 2023-10-18 23:45 UTC (permalink / raw)
  To: Christoph Berg <myon@debian.org>; +Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>

On Wed, Oct 18, 2023 at 05:59:19PM +0200, Christoph Berg wrote:
> I'm not entirely sure this is the commit to blame, but it's certainly
> close:

That would be in this area, thanks for the report.

> A Debian user is complaining that in PG17, the installed
> /usr/include/postgresql/17/server/utils/wait_event.h file is
> referencing utils/wait_event_types.h, but that file doesn't get
> installed by the (autoconf) build sytem.

On a fresh install of HEAD (3f9b1f26ca), I get:
$ cd $(pg_config --includedir-server)
$ find . -name wait_event.h
./utils/wait_event.h
$ find . -name wait_event_types.h
./utils/wait_event_types.h

But I have missed a piece related to VPATH builds for
wait_event_types.h in src/include/Makefile (see around probes.h).
Will fix as per the attached.  Thanks for the report.
--
Michael

Attachments:

waitevent-include.patch (text/x-diff, 666B) download diff --git a/src/include/Makefile b/src/include/Makefile index 2d5242561c..a7ca277803 100644 --- a/src/include/Makefile +++ b/src/include/Makefile @@ -54,7 +54,7 @@ install: all installdirs $(INSTALL_DATA) $(srcdir)/$$dir/*.h '$(DESTDIR)$(includedir_server)'/$$dir || exit; \ done ifeq ($(vpath_build),yes) - for file in catalog/schemapg.h catalog/system_fk_info.h catalog/pg_*_d.h storage/lwlocknames.h utils/probes.h; do \ + for file in catalog/schemapg.h catalog/system_fk_info.h catalog/pg_*_d.h storage/lwlocknames.h utils/probes.h utils/wait_event_types.h; do \ $(INSTALL_DATA) $$file '$(DESTDIR)$(includedir_server)'/$$file || exit; \ done endif
signature.asc (application/pgp-signature, 832B) download ^ permalink raw reply [nested|flat] 5+ messages in thread

* Re: pgsql: Generate automatically code and documentation related to wait ev
@ 2023-10-19 07:38  Christoph Berg <myon@debian.org>
  parent: Michael Paquier <michael@paquier.xyz>
  0 siblings, 1 reply; 5+ messages in thread

From: Christoph Berg @ 2023-10-19 07:38 UTC (permalink / raw)
  To: Michael Paquier <michael@paquier.xyz>; +Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>

Re: Michael Paquier
> Will fix as per the attached.  Thanks for the report.

Thanks for the lightning-fast fix :)

Christoph





^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: pgsql: Generate automatically code and documentation related to wait ev
@ 2023-10-19 08:46  Michael Paquier <michael@paquier.xyz>
  parent: Christoph Berg <myon@debian.org>
  0 siblings, 0 replies; 5+ messages in thread

From: Michael Paquier @ 2023-10-19 08:46 UTC (permalink / raw)
  To: Christoph Berg <myon@debian.org>; +Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>

On Thu, Oct 19, 2023 at 09:38:30AM +0200, Christoph Berg wrote:
> Thanks for the lightning-fast fix :)

No pb.  Not the first one, not the last one.  ;)
--
Michael

Attachments:

  signature.asc (application/pgp-signature, 832B) download

^ permalink  raw  reply  [nested|flat] 5+ messages in thread


end of thread, other threads:[~2023-10-19 08:46 UTC | newest]

Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2023-07-05 01:55 pgsql: Generate automatically code and documentation related to wait ev Michael Paquier <michael@paquier.xyz>
2023-10-18 15:59 ` Christoph Berg <myon@debian.org>
2023-10-18 23:45   ` Michael Paquier <michael@paquier.xyz>
2023-10-19 07:38     ` Christoph Berg <myon@debian.org>
2023-10-19 08:46       ` Michael Paquier <michael@paquier.xyz>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox