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 <g...@burd.me> Discussion: https://postgr.es/m/z_y9ttnxubvya...@paquier.xyz Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/371f2db8b05e4d46cbf489f05cbfc4d6ed6976d4 Modified Files -------------- doc/src/sgml/xfunc.sgml | 16 ++++++++++------ src/backend/access/gin/ginbtree.c | 6 +++--- src/backend/access/heap/heapam.c | 2 +- src/backend/access/index/genam.c | 2 +- src/backend/access/transam/multixact.c | 4 ++-- src/backend/access/transam/xlog.c | 2 +- src/backend/commands/indexcmds.c | 4 ++-- src/backend/executor/nodeAgg.c | 10 +++++----- src/backend/libpq/be-secure-gssapi.c | 2 +- src/backend/libpq/be-secure.c | 2 +- src/backend/postmaster/autovacuum.c | 2 +- src/backend/storage/aio/aio.c | 2 +- src/backend/tcop/backend_startup.c | 2 +- src/backend/tcop/postgres.c | 6 +++--- src/backend/utils/cache/catcache.c | 2 +- src/backend/utils/cache/inval.c | 2 +- src/backend/utils/cache/typcache.c | 2 +- src/backend/utils/init/postinit.c | 2 +- src/backend/utils/misc/injection_point.c | 8 ++++---- src/include/utils/injection_point.h | 15 ++++++++------- src/test/modules/injection_points/injection_points.c | 19 +++++++++++-------- src/test/modules/test_aio/test_aio.c | 12 ++++++++---- src/test/modules/test_slru/test_multixact.c | 2 +- 23 files changed, 69 insertions(+), 57 deletions(-)