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: Introduce private data area for injection points
Date: Sun, 12 May 2024 09:57:12 +0000
Message-ID: <E1s65x9-000cVl-0v@gemulon.postgresql.org> (raw)

Introduce private data area for injection points

This commit extends the backend-side infrastructure of injection points
so as it becomes possible to register some input data when attaching a
point.  This private data can be registered with the function name and
the library name of the callback when attaching a point, then it is
given as input argument to the callback.  This gives the possibility for
modules to pass down custom data at runtime when attaching a point
without managing that internally, in a manner consistent with the
callback entry retrieved from the hash shmem table storing the injection
point data.

InjectionPointAttach() gains two arguments, to be able to define the
private data contents and its size.

A follow-up commit will rely on this infrastructure to close a race
condition with the injection point detach in the module
injection_points.

While on it, this changes InjectionPointDetach() to return a boolean,
returning false if a point cannot be detached.  This has been mentioned
by Noah as useful when it comes to implement more complex tests with
concurrent point detach, solid with the automatic detach done for local
points in the test module.

Documentation is adjusted in consequence.

Per discussion with Noah Misch.

Reviewed-by: Noah Misch
Discussion: https://postgr.es/m/20240509031553.47@rfd.leadboat.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/33181b48fd0ee62bc0a9e39291d5a5c4f8540354

Modified Files
--------------
doc/src/sgml/xfunc.sgml                            | 14 ++++--
src/backend/utils/misc/injection_point.c           | 55 +++++++++++++++++-----
src/include/utils/injection_point.h                |  9 ++--
.../injection_points/expected/injection_points.out |  2 +-
.../modules/injection_points/injection_points.c    | 22 +++++----
5 files changed, 74 insertions(+), 28 deletions(-)



Message-ID: <E1s65x9-000cVl-0v@gemulon.postgresql.org>
Permalink:  ../E1s65x9-000cVl-0v@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1s65x9-000cVl-0v@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: Introduce private data area for injection points
  In-Reply-To: <E1s65x9-000cVl-0v@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