pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Paquier <michael@paquier.xyz>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Support custom wait events for wait event type "Extension"
Date: Mon, 31 Jul 2023 08:12:49 +0000
Message-ID: <E1qQO1I-0027W6-8l@gemulon.postgresql.org> (raw)

Support custom wait events for wait event type "Extension"

Two backend routines are added to allow extension to allocate and define
custom wait events, all of these being allocated in the type
"Extension":
* WaitEventExtensionNew(), that allocates a wait event ID computed from
a counter in shared memory.
* WaitEventExtensionRegisterName(), to associate a custom string to the
wait event ID allocated.

Note that this includes an example of how to use this new facility in
worker_spi with tests in TAP for various scenarios, and some
documentation about how to use them.

Any code in the tree that currently uses WAIT_EVENT_EXTENSION could
switch to this new facility to define custom wait events.  This is left
as work for future patches.

Author: Masahiro Ikeda
Reviewed-by: Andres Freund, Michael Paquier, Tristan Partin, Bharath
Rupireddy
Discussion: https://postgr.es/m/b9f5411acda0cf15c8fbb767702ff43e@oss.nttdata.com

Branch
------
master

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

Modified Files
--------------
doc/src/sgml/monitoring.sgml                       |  11 +-
doc/src/sgml/xfunc.sgml                            |  45 ++++++
src/backend/storage/ipc/ipci.c                     |   3 +
.../utils/activity/generate-wait_event_types.pl    |   7 +-
src/backend/utils/activity/wait_event.c            | 178 ++++++++++++++++++++-
src/backend/utils/activity/wait_event_names.txt    |   2 +-
src/include/utils/wait_event.h                     |  26 +++
src/test/modules/worker_spi/t/001_worker_spi.pl    |  34 +++-
src/test/modules/worker_spi/worker_spi--1.0.sql    |   5 +
src/test/modules/worker_spi/worker_spi.c           | 103 +++++++++++-
src/tools/pgindent/typedefs.list                   |   2 +
11 files changed, 393 insertions(+), 23 deletions(-)



Message-ID: <E1qQO1I-0027W6-8l@gemulon.postgresql.org>
Permalink:  ../E1qQO1I-0027W6-8l@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1qQO1I-0027W6-8l@gemulon.postgresql.org

 · 

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: pgsql-committers@postgresql.org
  Cc: michael@paquier.xyz, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Support custom wait events for wait event type "Extension"
  In-Reply-To: <E1qQO1I-0027W6-8l@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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