Re: Injection points: preloading and runtime arguments

Heikki Linnakangas <hlinnaka@iki.fi>

From: Heikki Linnakangas <hlinnaka@iki.fi>
To: Michael Paquier <michael@paquier.xyz>, "Andrey M. Borodin" <x4mmm@yandex-team.ru>
Cc: Alvaro Herrera <alvherre@alvh.no-ip.org>, Postgres hackers <pgsql-hackers@lists.postgresql.org>
Date: 2024-07-09T09:08:26Z
Lists: pgsql-hackers
On 05/07/2024 12:16, Michael Paquier wrote:
> On Mon, Jun 10, 2024 at 03:10:33PM +0900, Michael Paquier wrote:
>> OK, cool.  I'll try to get that into the tree once v18 opens up.
> 
> And I've spent more time on this one, and applied it to v18 after some
> slight tweaks.

If you do:

INJECTION_POINT_LOAD(foo);

START_CRIT_SECTION();
INJECTION_POINT(foo);
END_CRIT_SECTION();

And the injection point is attached in between the 
INJECTION_POINT_LOAD() and INJECTION_POINT() calls, you will still get 
an assertion failure. For a testing facility, maybe that's acceptable, 
but it could be fixed pretty easily.

I propose we introduce an INJECTION_POINT_CACHED(name) macro that *only* 
uses the local cache. We could then also add an assertion in 
InjectionPointRun() to check that it's not used in a critical section, 
to enforce correct usage.

-- 
Heikki Linnakangas
Neon (https://neon.tech)




Commits

  1. Add INJECTION_POINT_CACHED() to run injection points directly from cache

  2. Support loading of injection points