Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc259ba8

Browse files
committed
aio: Use runtime arguments with injections points in tests
This cleans up the code related to the testing infrastructure of AIOthat used injection points, switching the test code to use the newfacility for injection points added by371f2db rather than tweaksto pass and reset arguments to the callbacks run.This removes all the dependencies to USE_INJECTION_POINTS in the AIOcode. pgaio_io_call_inj(), pgaio_inj_io_get() and pgaio_inj_cur_handleare now gone.Reviewed-by: Greg Burd <greg@burd.me>Discussion:https://postgr.es/m/Z_y9TtnXubvYAApS@paquier.xyz
1 parent36e5fda commitc259ba8

File tree

4 files changed

+5
-80
lines changed

4 files changed

+5
-80
lines changed

‎src/backend/storage/aio/aio.c

Lines changed: 2 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,10 @@
4646
#include"storage/aio_subsys.h"
4747
#include"utils/guc.h"
4848
#include"utils/guc_hooks.h"
49+
#include"utils/injection_point.h"
4950
#include"utils/resowner.h"
5051
#include"utils/wait_event_types.h"
5152

52-
#ifdefUSE_INJECTION_POINTS
53-
#include"utils/injection_point.h"
54-
#endif
55-
5653

5754
staticinlinevoidpgaio_io_update_state(PgAioHandle*ioh,PgAioHandleStatenew_state);
5855
staticvoidpgaio_io_reclaim(PgAioHandle*ioh);
@@ -96,17 +93,6 @@ static const IoMethodOps *const pgaio_method_ops_table[] = {
9693
constIoMethodOps*pgaio_method_ops;
9794

9895

99-
/*
100-
* Currently there's no infrastructure to pass arguments to injection points,
101-
* so we instead set this up for the duration of the injection point
102-
* invocation. See pgaio_io_call_inj().
103-
*/
104-
#ifdefUSE_INJECTION_POINTS
105-
staticPgAioHandle*pgaio_inj_cur_handle;
106-
#endif
107-
108-
109-
11096
/* --------------------------------------------------------------------------------
11197
* Public Functions related to PgAioHandle
11298
* --------------------------------------------------------------------------------
@@ -507,7 +493,7 @@ pgaio_io_process_completion(PgAioHandle *ioh, int result)
507493

508494
pgaio_io_update_state(ioh,PGAIO_HS_COMPLETED_IO);
509495

510-
pgaio_io_call_inj(ioh,"aio-process-completion-before-shared");
496+
INJECTION_POINT("aio-process-completion-before-shared",ioh);
511497

512498
pgaio_io_call_complete_shared(ioh);
513499

@@ -1255,43 +1241,3 @@ check_io_max_concurrency(int *newval, void **extra, GucSource source)
12551241

12561242
return true;
12571243
}
1258-
1259-
1260-
1261-
/* --------------------------------------------------------------------------------
1262-
* Injection point support
1263-
* --------------------------------------------------------------------------------
1264-
*/
1265-
1266-
#ifdefUSE_INJECTION_POINTS
1267-
1268-
/*
1269-
* Call injection point with support for pgaio_inj_io_get().
1270-
*/
1271-
void
1272-
pgaio_io_call_inj(PgAioHandle*ioh,constchar*injection_point)
1273-
{
1274-
pgaio_inj_cur_handle=ioh;
1275-
1276-
PG_TRY();
1277-
{
1278-
InjectionPointCached(injection_point,NULL);
1279-
}
1280-
PG_FINALLY();
1281-
{
1282-
pgaio_inj_cur_handle=NULL;
1283-
}
1284-
PG_END_TRY();
1285-
}
1286-
1287-
/*
1288-
* Return IO associated with injection point invocation. This is only needed
1289-
* as injection points currently don't support arguments.
1290-
*/
1291-
PgAioHandle*
1292-
pgaio_inj_io_get(void)
1293-
{
1294-
returnpgaio_inj_cur_handle;
1295-
}
1296-
1297-
#endif

‎src/backend/storage/aio/method_worker.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
#include"storage/latch.h"
4343
#include"storage/proc.h"
4444
#include"tcop/tcopprot.h"
45+
#include"utils/injection_point.h"
4546
#include"utils/memdebug.h"
4647
#include"utils/ps_status.h"
4748
#include"utils/wait_event.h"
@@ -525,7 +526,7 @@ IoWorkerMain(const void *startup_data, size_t startup_data_len)
525526
* To be able to exercise the reopen-fails path, allow injection
526527
* points to trigger a failure at this point.
527528
*/
528-
pgaio_io_call_inj(ioh,"aio-worker-after-reopen");
529+
INJECTION_POINT("aio-worker-after-reopen",ioh);
529530

530531
error_errno=0;
531532
error_ioh=NULL;

‎src/include/storage/aio_internal.h

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -394,26 +394,6 @@ extern const char *pgaio_io_get_target_name(PgAioHandle *ioh);
394394
pgaio_io_get_state_name(ioh), \
395395
__VA_ARGS__)
396396

397-
398-
#ifdefUSE_INJECTION_POINTS
399-
400-
externvoidpgaio_io_call_inj(PgAioHandle*ioh,constchar*injection_point);
401-
402-
/* just for use in tests, from within injection points */
403-
externPgAioHandle*pgaio_inj_io_get(void);
404-
405-
#else
406-
407-
#definepgaio_io_call_inj(ioh,injection_point) (void) 0
408-
409-
/*
410-
* no fallback for pgaio_inj_io_get, all code using injection points better be
411-
* guarded by USE_INJECTION_POINTS.
412-
*/
413-
414-
#endif
415-
416-
417397
/* Declarations for the tables of function pointers exposed by each IO method. */
418398
externPGDLLIMPORTconstIoMethodOpspgaio_sync_ops;
419399
externPGDLLIMPORTconstIoMethodOpspgaio_worker_ops;

‎src/test/modules/test_aio/test_aio.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -684,7 +684,7 @@ extern PGDLLEXPORT void inj_io_reopen(const char *name,
684684
void
685685
inj_io_short_read(constchar*name,constvoid*private_data,void*arg)
686686
{
687-
PgAioHandle*ioh;
687+
PgAioHandle*ioh= (PgAioHandle*)arg;
688688

689689
ereport(LOG,
690690
errmsg("short read injection point called, is enabled: %d",
@@ -693,8 +693,6 @@ inj_io_short_read(const char *name, const void *private_data, void *arg)
693693

694694
if (inj_io_error_state->enabled_short_read)
695695
{
696-
ioh=pgaio_inj_io_get();
697-
698696
/*
699697
* Only shorten reads that are actually longer than the target size,
700698
* otherwise we can trigger over-reads.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp