aboutsummaryrefslogtreecommitdiff
path: root/src/test/modules/test_aio/test_aio.c
diff options
context:
space:
mode:
authorMichael Paquier <michael@paquier.xyz>2025-05-10 06:56:26 +0900
committerMichael Paquier <michael@paquier.xyz>2025-05-10 06:56:26 +0900
commit371f2db8b05e4d46cbf489f05cbfc4d6ed6976d4 (patch)
treeaf10abf135f4a14534d31c7d8f95d7bed9b4e949 /src/test/modules/test_aio/test_aio.c
parent89372d0aaa4a6f0e560acdf9014c5ad66fdde1b1 (diff)
downloadpostgresql-371f2db8b05e4d46cbf489f05cbfc4d6ed6976d4.tar.gz
postgresql-371f2db8b05e4d46cbf489f05cbfc4d6ed6976d4.zip
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
Diffstat (limited to 'src/test/modules/test_aio/test_aio.c')
-rw-r--r--src/test/modules/test_aio/test_aio.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/test/modules/test_aio/test_aio.c b/src/test/modules/test_aio/test_aio.c
index 7745244b0e2..681d5d73d47 100644
--- a/src/test/modules/test_aio/test_aio.c
+++ b/src/test/modules/test_aio/test_aio.c
@@ -674,11 +674,15 @@ batch_end(PG_FUNCTION_ARGS)
}
#ifdef USE_INJECTION_POINTS
-extern PGDLLEXPORT void inj_io_short_read(const char *name, const void *private_data);
-extern PGDLLEXPORT void inj_io_reopen(const char *name, const void *private_data);
+extern PGDLLEXPORT void inj_io_short_read(const char *name,
+ const void *private_data,
+ void *arg);
+extern PGDLLEXPORT void inj_io_reopen(const char *name,
+ const void *private_data,
+ void *arg);
void
-inj_io_short_read(const char *name, const void *private_data)
+inj_io_short_read(const char *name, const void *private_data, void *arg)
{
PgAioHandle *ioh;
@@ -742,7 +746,7 @@ inj_io_short_read(const char *name, const void *private_data)
}
void
-inj_io_reopen(const char *name, const void *private_data)
+inj_io_reopen(const char *name, const void *private_data, void *arg)
{
ereport(LOG,
errmsg("reopen injection point called, is enabled: %d",