diff options
author | Michael Paquier | 2024-07-05 08:41:49 +0000 |
---|---|---|
committer | Michael Paquier | 2024-07-05 09:09:03 +0000 |
commit | 4b211003ecc2946dc0052b650141ea4e8f35254c (patch) | |
tree | b2527e68e24c7554090b1f128367ea9bcd333096 /src/include/utils | |
parent | 98347b5a3ab116dd0892d112531e376cff5066fd (diff) |
Support loading of injection points
This can be used to load an injection point and prewarm the
backend-level cache before running it, to avoid issues if the point
cannot be loaded due to restrictions in the code path where it would be
run, like a critical section where no memory allocation can happen
(load_external_function() can do allocations when expanding a library
name).
Tests can use a macro called INJECTION_POINT_LOAD() to load an injection
point. The test module injection_points gains some tests, and a SQL
function able to load an injection point.
Based on a request from Andrey Borodin, who has implemented a test for
multixacts requiring this facility.
Reviewed-by: Andrey Borodin
Discussion: https://postgr.es/m/ZkrBE1e2q2wGvsoN@paquier.xyz
Diffstat (limited to 'src/include/utils')
-rw-r--r-- | src/include/utils/injection_point.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/include/utils/injection_point.h b/src/include/utils/injection_point.h index a61d5d44391..bd3a62425c3 100644 --- a/src/include/utils/injection_point.h +++ b/src/include/utils/injection_point.h @@ -15,8 +15,10 @@ * Injections points require --enable-injection-points. */ #ifdef USE_INJECTION_POINTS +#define INJECTION_POINT_LOAD(name) InjectionPointLoad(name) #define INJECTION_POINT(name) InjectionPointRun(name) #else +#define INJECTION_POINT_LOAD(name) ((void) name) #define INJECTION_POINT(name) ((void) name) #endif @@ -34,6 +36,7 @@ extern void InjectionPointAttach(const char *name, const char *function, const void *private_data, int private_data_size); +extern void InjectionPointLoad(const char *name); extern void InjectionPointRun(const char *name); extern bool InjectionPointDetach(const char *name); |