From 371f2db8b05e4d46cbf489f05cbfc4d6ed6976d4 Mon Sep 17 00:00:00 2001 From: Michael Paquier Date: Sat, 10 May 2025 06:56:26 +0900 Subject: 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 Discussion: https://postgr.es/m/Z_y9TtnXubvYAApS@paquier.xyz --- src/backend/executor/nodeAgg.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/backend/executor/nodeAgg.c') diff --git a/src/backend/executor/nodeAgg.c b/src/backend/executor/nodeAgg.c index f83fc16c5c8..377e016d732 100644 --- a/src/backend/executor/nodeAgg.c +++ b/src/backend/executor/nodeAgg.c @@ -1492,7 +1492,7 @@ build_hash_tables(AggState *aggstate) if (IS_INJECTION_POINT_ATTACHED("hash-aggregate-oversize-table")) { nbuckets = memory / TupleHashEntrySize(); - INJECTION_POINT_CACHED("hash-aggregate-oversize-table"); + INJECTION_POINT_CACHED("hash-aggregate-oversize-table", NULL); } #endif @@ -1882,7 +1882,7 @@ hash_agg_check_limits(AggState *aggstate) if (IS_INJECTION_POINT_ATTACHED("hash-aggregate-spill-1000")) { do_spill = true; - INJECTION_POINT_CACHED("hash-aggregate-spill-1000"); + INJECTION_POINT_CACHED("hash-aggregate-spill-1000", NULL); } } #endif @@ -1910,7 +1910,7 @@ hash_agg_check_limits(AggState *aggstate) static void hash_agg_enter_spill_mode(AggState *aggstate) { - INJECTION_POINT("hash-aggregate-enter-spill-mode"); + INJECTION_POINT("hash-aggregate-enter-spill-mode", NULL); aggstate->hash_spill_mode = true; hashagg_recompile_expressions(aggstate, aggstate->table_filled, true); @@ -2739,7 +2739,7 @@ agg_refill_hash_table(AggState *aggstate) */ hashagg_recompile_expressions(aggstate, true, true); - INJECTION_POINT("hash-aggregate-process-batch"); + INJECTION_POINT("hash-aggregate-process-batch", NULL); for (;;) { TupleTableSlot *spillslot = aggstate->hash_spill_rslot; @@ -2995,7 +2995,7 @@ hashagg_spill_init(HashAggSpill *spill, LogicalTapeSet *tapeset, int used_bits, { npartitions = 1; partition_bits = 0; - INJECTION_POINT_CACHED("hash-aggregate-single-partition"); + INJECTION_POINT_CACHED("hash-aggregate-single-partition", NULL); } #endif -- cgit v1.2.3