From: Michael Paquier <michael@paquier.xyz>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Add INJECTION_POINT_CACHED() to run injection points directly fr
Date: Thu, 18 Jul 2024 00:51:29 +0000
Message-ID: <E1sUFMn-0003ze-Qm@gemulon.postgresql.org> (raw)
Add INJECTION_POINT_CACHED() to run injection points directly from cache
This new macro is able to perform a direct lookup from the local cache
of injection points (refreshed each time a point is loaded or run),
without touching the shared memory state of injection points at all.
This works in combination with INJECTION_POINT_LOAD(), and it is better
than INJECTION_POINT() in a critical section due to the fact that it
would avoid all memory allocations should a concurrent detach happen
since a LOAD(), as it retrieves a callback from the backend-private
memory.
The documentation is updated to describe in more details how to use this
new macro with a load. Some tests are added to the module
injection_points based on a new SQL function that acts as a wrapper of
INJECTION_POINT_CACHED().
Based on a suggestion from Heikki Linnakangas.
Author: Heikki Linnakangas, Michael Paquier
Discussion: https://postgr.es/m/58d588d0-e63f-432f-9181-bed29313dece@iki.fi
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/a0a5869a8598cdeae1d2f2d632038d26dcc69d19
Modified Files
--------------
doc/src/sgml/xfunc.sgml | 17 ++++++++++-------
src/backend/utils/misc/injection_point.c | 17 +++++++++++++++++
src/include/utils/injection_point.h | 3 +++
.../injection_points/expected/injection_points.out | 13 +++++++++++++
.../modules/injection_points/injection_points--1.0.sql | 10 ++++++++++
src/test/modules/injection_points/injection_points.c | 14 ++++++++++++++
.../modules/injection_points/sql/injection_points.sql | 2 ++
7 files changed, 69 insertions(+), 7 deletions(-)
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 INJECTION_POINT_CACHED() to run injection points directly fr
In-Reply-To: <E1sUFMn-0003ze-Qm@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