diff options
author | Michael Paquier | 2025-05-09 21:56:26 +0000 |
---|---|---|
committer | Michael Paquier | 2025-05-09 21:56:26 +0000 |
commit | 371f2db8b05e4d46cbf489f05cbfc4d6ed6976d4 (patch) | |
tree | af10abf135f4a14534d31c7d8f95d7bed9b4e949 /src/backend/access | |
parent | 89372d0aaa4a6f0e560acdf9014c5ad66fdde1b1 (diff) |
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 <[email protected]>
Discussion: https://postgr.es/m/[email protected]
Diffstat (limited to 'src/backend/access')
-rw-r--r-- | src/backend/access/gin/ginbtree.c | 6 | ||||
-rw-r--r-- | src/backend/access/heap/heapam.c | 2 | ||||
-rw-r--r-- | src/backend/access/index/genam.c | 2 | ||||
-rw-r--r-- | src/backend/access/transam/multixact.c | 4 | ||||
-rw-r--r-- | src/backend/access/transam/xlog.c | 2 |
5 files changed, 8 insertions, 8 deletions
diff --git a/src/backend/access/gin/ginbtree.c b/src/backend/access/gin/ginbtree.c index 26a0bdc2063..644d484ea53 100644 --- a/src/backend/access/gin/ginbtree.c +++ b/src/backend/access/gin/ginbtree.c @@ -685,9 +685,9 @@ ginFinishSplit(GinBtree btree, GinBtreeStack *stack, bool freestack, #ifdef USE_INJECTION_POINTS if (GinPageIsLeaf(BufferGetPage(stack->buffer))) - INJECTION_POINT("gin-leave-leaf-split-incomplete"); + INJECTION_POINT("gin-leave-leaf-split-incomplete", NULL); else - INJECTION_POINT("gin-leave-internal-split-incomplete"); + INJECTION_POINT("gin-leave-internal-split-incomplete", NULL); #endif /* search parent to lock */ @@ -778,7 +778,7 @@ ginFinishSplit(GinBtree btree, GinBtreeStack *stack, bool freestack, static void ginFinishOldSplit(GinBtree btree, GinBtreeStack *stack, GinStatsData *buildStats, int access) { - INJECTION_POINT("gin-finish-incomplete-split"); + INJECTION_POINT("gin-finish-incomplete-split", NULL); elog(DEBUG1, "finishing incomplete split of block %u in gin index \"%s\"", stack->blkno, RelationGetRelationName(btree->index)); diff --git a/src/backend/access/heap/heapam.c b/src/backend/access/heap/heapam.c index c1a4de14a59..9ec8cda1c68 100644 --- a/src/backend/access/heap/heapam.c +++ b/src/backend/access/heap/heapam.c @@ -3304,7 +3304,7 @@ heap_update(Relation relation, ItemPointer otid, HeapTuple newtup, interesting_attrs = bms_add_members(interesting_attrs, id_attrs); block = ItemPointerGetBlockNumber(otid); - INJECTION_POINT("heap_update-before-pin"); + INJECTION_POINT("heap_update-before-pin", NULL); buffer = ReadBuffer(relation, block); page = BufferGetPage(buffer); diff --git a/src/backend/access/index/genam.c b/src/backend/access/index/genam.c index 8f532e14590..0cb27af1310 100644 --- a/src/backend/access/index/genam.c +++ b/src/backend/access/index/genam.c @@ -851,7 +851,7 @@ systable_inplace_update_begin(Relation relation, if (retries++ > 10000) elog(ERROR, "giving up after too many tries to overwrite row"); - INJECTION_POINT("inplace-before-pin"); + INJECTION_POINT("inplace-before-pin", NULL); scan = systable_beginscan(relation, indexId, indexOK, snapshot, nkeys, unconstify(ScanKeyData *, key)); oldtup = systable_getnext(scan); diff --git a/src/backend/access/transam/multixact.c b/src/backend/access/transam/multixact.c index ef91e70f41d..3c06ac45532 100644 --- a/src/backend/access/transam/multixact.c +++ b/src/backend/access/transam/multixact.c @@ -872,7 +872,7 @@ MultiXactIdCreateFromMembers(int nmembers, MultiXactMember *members) */ multi = GetNewMultiXactId(nmembers, &offset); - INJECTION_POINT_CACHED("multixact-create-from-members"); + INJECTION_POINT_CACHED("multixact-create-from-members", NULL); /* Make an XLOG entry describing the new MXID. */ xlrec.mid = multi; @@ -1486,7 +1486,7 @@ retry: LWLockRelease(lock); CHECK_FOR_INTERRUPTS(); - INJECTION_POINT("multixact-get-members-cv-sleep"); + INJECTION_POINT("multixact-get-members-cv-sleep", NULL); ConditionVariableSleep(&MultiXactState->nextoff_cv, WAIT_EVENT_MULTIXACT_CREATION); diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 2d4c346473b..1914859b2ee 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -7882,7 +7882,7 @@ CreateRestartPoint(int flags) * This location needs to be after CheckPointGuts() to ensure that some * work has already happened during this checkpoint. */ - INJECTION_POINT("create-restart-point"); + INJECTION_POINT("create-restart-point", NULL); /* * Remember the prior checkpoint's redo ptr for |