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>
Cc: Andres Freund <andres@anarazel.de>, Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>, Tristan Partin <tristan@neon.tech>, pgsql-hackers@lists.postgresql.org
Date: 2023-08-10T04:08:39Z
Lists: pgsql-hackers

Attachments

Hi,

Thanks for your comments about the v2 patches. I updated to v3 patches.

The main changes are:
* remove the AddinShmemInitLock assertion
* add the new lock (WaitEventExtensionLock) to wait_event_names.txt
* change "static const int wee_hash_XXX_size" to "#define XXX"
* simplify worker_spi. I removed codes related to share memory and
   try to allocate the new wait event before waiting per background 
worker.
* change to elog from ereport because the errors are for developers.
* revise comments as advised.
* fix the request size for shared memory correctly
* simplify dblink.c
* fix process ordering of WaitEventExtensionNew() as advised to
   avoid leading illegal state.

In addition, I change the followings:
* update about custom wait events in sgml. we don't need to use
   shmem_startup_hook.
* change the hash names for readability.
  (ex. WaitEventExtensionNameHash -> WaitEventExtensionHashById)
* fix a bug to fail to get already defined events by names
   because HASH_BLOBS was specified. HASH_STRINGS is right since
   the key is C strings.

I create a new entry in commitfest for CI testing.
(https://commitfest.postgresql.org/44/4494/)

Thanks for closing the former entry.
(https://commitfest.postgresql.org/43/4368/)

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