mirror of
https://github.com/postgres/postgres.git
synced 2025-10-27 00:12:01 +03:00
aio: Use runtime arguments with injections points in tests
This cleans up the code related to the testing infrastructure of AIO
that used injection points, switching the test code to use the new
facility for injection points added by 371f2db8b0 rather than tweaks
to pass and reset arguments to the callbacks run.
This removes all the dependencies to USE_INJECTION_POINTS in the AIO
code. pgaio_io_call_inj(), pgaio_inj_io_get() and pgaio_inj_cur_handle
are now gone.
Reviewed-by: Greg Burd <greg@burd.me>
Discussion: https://postgr.es/m/Z_y9TtnXubvYAApS@paquier.xyz
This commit is contained in:
@@ -46,13 +46,10 @@
|
||||
#include "storage/aio_subsys.h"
|
||||
#include "utils/guc.h"
|
||||
#include "utils/guc_hooks.h"
|
||||
#include "utils/injection_point.h"
|
||||
#include "utils/resowner.h"
|
||||
#include "utils/wait_event_types.h"
|
||||
|
||||
#ifdef USE_INJECTION_POINTS
|
||||
#include "utils/injection_point.h"
|
||||
#endif
|
||||
|
||||
|
||||
static inline void pgaio_io_update_state(PgAioHandle *ioh, PgAioHandleState new_state);
|
||||
static void pgaio_io_reclaim(PgAioHandle *ioh);
|
||||
@@ -96,17 +93,6 @@ static const IoMethodOps *const pgaio_method_ops_table[] = {
|
||||
const IoMethodOps *pgaio_method_ops;
|
||||
|
||||
|
||||
/*
|
||||
* Currently there's no infrastructure to pass arguments to injection points,
|
||||
* so we instead set this up for the duration of the injection point
|
||||
* invocation. See pgaio_io_call_inj().
|
||||
*/
|
||||
#ifdef USE_INJECTION_POINTS
|
||||
static PgAioHandle *pgaio_inj_cur_handle;
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/* --------------------------------------------------------------------------------
|
||||
* Public Functions related to PgAioHandle
|
||||
* --------------------------------------------------------------------------------
|
||||
@@ -507,7 +493,7 @@ pgaio_io_process_completion(PgAioHandle *ioh, int result)
|
||||
|
||||
pgaio_io_update_state(ioh, PGAIO_HS_COMPLETED_IO);
|
||||
|
||||
pgaio_io_call_inj(ioh, "aio-process-completion-before-shared");
|
||||
INJECTION_POINT("aio-process-completion-before-shared", ioh);
|
||||
|
||||
pgaio_io_call_complete_shared(ioh);
|
||||
|
||||
@@ -1255,43 +1241,3 @@ check_io_max_concurrency(int *newval, void **extra, GucSource source)
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* --------------------------------------------------------------------------------
|
||||
* Injection point support
|
||||
* --------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifdef USE_INJECTION_POINTS
|
||||
|
||||
/*
|
||||
* Call injection point with support for pgaio_inj_io_get().
|
||||
*/
|
||||
void
|
||||
pgaio_io_call_inj(PgAioHandle *ioh, const char *injection_point)
|
||||
{
|
||||
pgaio_inj_cur_handle = ioh;
|
||||
|
||||
PG_TRY();
|
||||
{
|
||||
InjectionPointCached(injection_point, NULL);
|
||||
}
|
||||
PG_FINALLY();
|
||||
{
|
||||
pgaio_inj_cur_handle = NULL;
|
||||
}
|
||||
PG_END_TRY();
|
||||
}
|
||||
|
||||
/*
|
||||
* Return IO associated with injection point invocation. This is only needed
|
||||
* as injection points currently don't support arguments.
|
||||
*/
|
||||
PgAioHandle *
|
||||
pgaio_inj_io_get(void)
|
||||
{
|
||||
return pgaio_inj_cur_handle;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -42,6 +42,7 @@
|
||||
#include "storage/latch.h"
|
||||
#include "storage/proc.h"
|
||||
#include "tcop/tcopprot.h"
|
||||
#include "utils/injection_point.h"
|
||||
#include "utils/memdebug.h"
|
||||
#include "utils/ps_status.h"
|
||||
#include "utils/wait_event.h"
|
||||
@@ -525,7 +526,7 @@ IoWorkerMain(const void *startup_data, size_t startup_data_len)
|
||||
* To be able to exercise the reopen-fails path, allow injection
|
||||
* points to trigger a failure at this point.
|
||||
*/
|
||||
pgaio_io_call_inj(ioh, "aio-worker-after-reopen");
|
||||
INJECTION_POINT("aio-worker-after-reopen", ioh);
|
||||
|
||||
error_errno = 0;
|
||||
error_ioh = NULL;
|
||||
|
||||
Reference in New Issue
Block a user