PostgreSQL Source Code git master
Loading...
Searching...
No Matches
test_checksums.c
Go to the documentation of this file.
1/*--------------------------------------------------------------------------
2 *
3 * test_checksums.c
4 * Test data checksums
5 *
6 * Copyright (c) 2026, PostgreSQL Global Development Group
7 *
8 * IDENTIFICATION
9 * src/test/modules/test_checksums/test_checksums.c
10 *
11 * -------------------------------------------------------------------------
12 */
13#include "postgres.h"
14
15#include "funcapi.h"
16#include "miscadmin.h"
18#include "storage/latch.h"
20#include "utils/wait_event.h"
21
23
24extern PGDLLEXPORT void dc_delay_barrier(const char *name, const void *private_data, void *arg);
25
26/*
27 * Test for delaying emission of procsignalbarriers.
28 */
29void
30dc_delay_barrier(const char *name, const void *private_data, void *arg)
31{
32 (void) name;
33 (void) private_data;
34
37 (3 * 1000),
39}
40
44{
45#ifdef USE_INJECTION_POINTS
46 bool attach = PG_GETARG_BOOL(0);
47
48 if (attach)
49 InjectionPointAttach("datachecksums-enable-checksums-delay",
50 "test_checksums",
51 "dc_delay_barrier",
52 NULL,
53 0);
54 else
55 InjectionPointDetach("datachecksums-enable-checksums-delay");
56#else
57 elog(ERROR,
58 "test is not working as intended when injection points are disabled");
59#endif
61}
62
66{
67#ifdef USE_INJECTION_POINTS
68 bool attach = PG_GETARG_BOOL(0);
69
70 if (attach)
71 InjectionPointAttach("datachecksumsworker-launcher-delay",
72 "test_checksums",
73 "dc_delay_barrier",
74 NULL,
75 0);
76 else
77 InjectionPointDetach("datachecksumsworker-launcher-delay");
78#else
79 elog(ERROR,
80 "test is not working as intended when injection points are disabled");
81#endif
83}
84
88{
89#ifdef USE_INJECTION_POINTS
90 bool attach = PG_GETARG_BOOL(0);
91
92 if (attach)
93 InjectionPointAttach("datachecksumsworker-startup-delay",
94 "test_checksums",
95 "dc_delay_barrier",
96 NULL,
97 0);
98 else
99 InjectionPointDetach("datachecksumsworker-startup-delay");
100#else
101 elog(ERROR,
102 "test is not working as intended when injection points are disabled");
103#endif
105}
#define PGDLLEXPORT
Definition c.h:1436
Datum arg
Definition elog.c:1323
#define ERROR
Definition elog.h:40
#define elog(elevel,...)
Definition elog.h:228
#define PG_RETURN_VOID()
Definition fmgr.h:350
#define PG_FUNCTION_INFO_V1(funcname)
Definition fmgr.h:417
#define PG_GETARG_BOOL(n)
Definition fmgr.h:274
#define PG_FUNCTION_ARGS
Definition fmgr.h:193
struct Latch * MyLatch
Definition globals.c:65
bool InjectionPointDetach(const char *name)
void InjectionPointAttach(const char *name, const char *library, const char *function, const void *private_data, int private_data_size)
int WaitLatch(Latch *latch, int wakeEvents, long timeout, uint32 wait_event_info)
Definition latch.c:172
uint64_t Datum
Definition postgres.h:70
static int fb(int x)
Datum dcw_inject_delay_barrier(PG_FUNCTION_ARGS)
Datum dcw_inject_startup_delay(PG_FUNCTION_ARGS)
PG_MODULE_MAGIC
Datum dcw_inject_launcher_delay(PG_FUNCTION_ARGS)
PGDLLEXPORT void dc_delay_barrier(const char *name, const void *private_data, void *arg)
const char * name
#define WL_TIMEOUT
#define WL_EXIT_ON_PM_DEATH
#define WL_LATCH_SET