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: Add support for runtime arguments in injection points
Date: Fri, 09 May 2025 21:58:58 +0000
Message-ID: <E1uDVk9-000ymr-2U@gemulon.postgresql.org> (raw)

Add support for runtime arguments in injection points

The macros INJECTION_POINT() and INJECTION_POINT_CACHED() are extended
with an optional argument that can be passed down to the callback
attached when an injection point is run, giving to callbacks the
possibility to manipulate a stack state given by the caller.  The
existing callbacks in modules injection_points and test_aio have their
declarations adjusted based on that.

da7226993fd4 (core AIO infrastructure) and 93bc3d75d8e1 (test_aio) and
been relying on a set of workarounds where a static variable called
pgaio_inj_cur_handle is used as runtime argument in the injection point
callbacks used by the AIO tests, in combination with a TRY/CATCH block
to reset the argument value.  The infrastructure introduced in this
commit will be reused for the AIO tests, simplifying them.

Reviewed-by: Greg Burd <greg@burd.me>
Discussion: https://postgr.es/m/Z_y9TtnXubvYAApS@paquier.xyz

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/371f2db8b05e4d46cbf489f05cbfc4d6ed6976d4

Modified Files
--------------
doc/src/sgml/xfunc.sgml                              | 16 ++++++++++------
src/backend/access/gin/ginbtree.c                    |  6 +++---
src/backend/access/heap/heapam.c                     |  2 +-
src/backend/access/index/genam.c                     |  2 +-
src/backend/access/transam/multixact.c               |  4 ++--
src/backend/access/transam/xlog.c                    |  2 +-
src/backend/commands/indexcmds.c                     |  4 ++--
src/backend/executor/nodeAgg.c                       | 10 +++++-----
src/backend/libpq/be-secure-gssapi.c                 |  2 +-
src/backend/libpq/be-secure.c                        |  2 +-
src/backend/postmaster/autovacuum.c                  |  2 +-
src/backend/storage/aio/aio.c                        |  2 +-
src/backend/tcop/backend_startup.c                   |  2 +-
src/backend/tcop/postgres.c                          |  6 +++---
src/backend/utils/cache/catcache.c                   |  2 +-
src/backend/utils/cache/inval.c                      |  2 +-
src/backend/utils/cache/typcache.c                   |  2 +-
src/backend/utils/init/postinit.c                    |  2 +-
src/backend/utils/misc/injection_point.c             |  8 ++++----
src/include/utils/injection_point.h                  | 15 ++++++++-------
src/test/modules/injection_points/injection_points.c | 19 +++++++++++--------
src/test/modules/test_aio/test_aio.c                 | 12 ++++++++----
src/test/modules/test_slru/test_multixact.c          |  2 +-
23 files changed, 69 insertions(+), 57 deletions(-)



Message-ID: <E1uDVk9-000ymr-2U@gemulon.postgresql.org>
Permalink:  ../E1uDVk9-000ymr-2U@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1uDVk9-000ymr-2U@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: Add support for runtime arguments in injection points
  In-Reply-To: <E1uDVk9-000ymr-2U@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