Re: Support to define custom wait events for extensions

Masahiro Ikeda <ikedamsh@oss.nttdata.com>

From: Masahiro Ikeda <ikedamsh@oss.nttdata.com>
To: Michael Paquier <michael@paquier.xyz>, andres@anarazel.de, tristan@neon.tech
Cc: pgsql-hackers@lists.postgresql.org
Date: 2023-07-19T03:52:10Z
Lists: pgsql-hackers

Attachments

Hi,

I updated the patches.
* v6-0001-Support-custom-wait-events-for-extensions.patch

The main diffs are

* rebase it atop current HEAD
* update docs to show users how to use the APIs
* rename of functions and variables
* fix typos
* define a new spinlock in shared memory for this purpose
* output an error if the number of wait event for extensions exceeds 
uint16
* show the wait event as "extension" if the custom wait event name is 
not
   registered, which is same as LWLock one.
* add test cases which confirm it works if new wait events for 
extensions
   are defined in initialize phase and after phase. And add a boundary
   condition test.

Please let me know if I forgot to handle something that you commented,
and there are better idea.

Note:
I would like to change the wait event name of contrib modules for 
example
postgres_fdw. But, I think it's better to do so after the APIs are 
committed.
The example mentioned in docs should be updated to the contrib modules 
codes,
not the test module.

Regards,
-- 
Masahiro Ikeda
NTT DATA CORPORATION

Commits

  1. Change custom wait events to use dynamic shared hash tables

  2. Support custom wait events for wait event type "Extension"

  3. Add WAIT_EVENT_{CLASS,ID}_MASK in wait_event.c

  4. worker_spi: Switch to TAP tests

  5. Simplify some conditions related to [LW]Lock in generate-wait_event_types.pl