PostgreSQL Source Code git master
test_multixact.c
Go to the documentation of this file.
1/*--------------------------------------------------------------------------
2 *
3 * test_multixact.c
4 * Support code for multixact testing
5 *
6 * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group
7 * Portions Copyright (c) 1994, Regents of the University of California
8 *
9 * IDENTIFICATION
10 * src/test/modules/test_slru/test_multixact.c
11 *
12 * -------------------------------------------------------------------------
13 */
14
15#include "postgres.h"
16
17#include "access/multixact.h"
18#include "access/xact.h"
19#include "fmgr.h"
21
24
25/*
26 * Produces multixact with 2 current xids
27 */
30{
31 MultiXactId id;
32
37}
38
39/*
40 * Reads given multixact after running an injection point. Discards local cache
41 * to make a real read. Tailored for multixact testing.
42 */
45{
47 MultiXactMember *members;
48
49 INJECTION_POINT("test-multixact-read");
50 /* discard caches */
52
53 if (GetMultiXactIdMembers(id, &members, false, false) == -1)
54 elog(ERROR, "MultiXactId not found");
55
57}
TransactionId MultiXactId
Definition: c.h:633
#define ERROR
Definition: elog.h:39
#define elog(elevel,...)
Definition: elog.h:225
#define PG_RETURN_VOID()
Definition: fmgr.h:349
#define PG_RETURN_TRANSACTIONID(x)
Definition: fmgr.h:364
#define PG_GETARG_TRANSACTIONID(n)
Definition: fmgr.h:279
#define PG_FUNCTION_ARGS
Definition: fmgr.h:193
#define INJECTION_POINT(name)
void MultiXactIdSetOldestMember(void)
Definition: multixact.c:673
MultiXactId MultiXactIdCreate(TransactionId xid1, MultiXactStatus status1, TransactionId xid2, MultiXactStatus status2)
Definition: multixact.c:434
void AtEOXact_MultiXact(void)
Definition: multixact.c:1808
int GetMultiXactIdMembers(MultiXactId multi, MultiXactMember **members, bool from_pgupgrade, bool isLockOnly)
Definition: multixact.c:1299
@ MultiXactStatusForShare
Definition: multixact.h:40
@ MultiXactStatusUpdate
Definition: multixact.h:46
uintptr_t Datum
Definition: postgres.h:69
PG_FUNCTION_INFO_V1(test_create_multixact)
Datum test_create_multixact(PG_FUNCTION_ARGS)
Datum test_read_multixact(PG_FUNCTION_ARGS)
TransactionId GetCurrentTransactionId(void)
Definition: xact.c:454