PostgreSQL Source Code git master
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
procarray.h
Go to the documentation of this file.
1/*-------------------------------------------------------------------------
2 *
3 * procarray.h
4 * POSTGRES process array definitions.
5 *
6 *
7 * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group
8 * Portions Copyright (c) 1994, Regents of the University of California
9 *
10 * src/include/storage/procarray.h
11 *
12 *-------------------------------------------------------------------------
13 */
14#ifndef PROCARRAY_H
15#define PROCARRAY_H
16
17#include "storage/lock.h"
18#include "storage/standby.h"
19#include "utils/relcache.h"
20#include "utils/snapshot.h"
21
22
23extern Size ProcArrayShmemSize(void);
24extern void ProcArrayShmemInit(void);
25extern void ProcArrayAdd(PGPROC *proc);
26extern void ProcArrayRemove(PGPROC *proc, TransactionId latestXid);
27
28extern void ProcArrayEndTransaction(PGPROC *proc, TransactionId latestXid);
29extern void ProcArrayClearTransaction(PGPROC *proc);
30
31extern void ProcArrayInitRecovery(TransactionId initializedUptoXID);
34 int nsubxids, TransactionId *subxids);
35
38 int nsubxids, TransactionId *subxids,
39 TransactionId max_xid);
43
44extern int GetMaxSnapshotXidCount(void);
45extern int GetMaxSnapshotSubxidCount(void);
46
47extern Snapshot GetSnapshotData(Snapshot snapshot);
48
50 VirtualTransactionId *sourcevxid);
52
54
61extern void GetReplicationHorizons(TransactionId *xmin, TransactionId *catalog_xmin);
62
65 int nvxids, int type);
66
67extern PGPROC *ProcNumberGetProc(int procNumber);
68extern void ProcNumberGetTransactionIds(int procNumber, TransactionId *xid,
69 TransactionId *xmin, int *nsubxid,
70 bool *overflowed);
71extern PGPROC *BackendPidGetProc(int pid);
72extern PGPROC *BackendPidGetProcWithLock(int pid);
73extern int BackendXidGetPid(TransactionId xid);
74extern bool IsBackendPid(int pid);
75
77 bool excludeXmin0, bool allDbs, int excludeVacuum,
78 int *nvxids);
82 bool conflictPending);
83
84extern bool MinimumActiveBackends(int min);
85extern int CountDBBackends(Oid databaseid);
86extern int CountDBConnections(Oid databaseid);
87extern void CancelDBBackends(Oid databaseid, ProcSignalReason sigmode, bool conflictPending);
88extern int CountUserBackends(Oid roleid);
89extern bool CountOtherDBBackends(Oid databaseId,
90 int *nbackends, int *nprepared);
91extern void TerminateOtherDBBackends(Oid databaseId);
92
94 int nxids, const TransactionId *xids,
95 TransactionId latestXid);
96
98 TransactionId catalog_xmin, bool already_locked);
99
101 TransactionId *catalog_xmin);
102
103#endif /* PROCARRAY_H */
uint32 TransactionId
Definition: c.h:606
size_t Size
Definition: c.h:559
unsigned int Oid
Definition: postgres_ext.h:31
TransactionId GetOldestNonRemovableTransactionId(Relation rel)
Definition: procarray.c:2005
void ProcArrayGetReplicationSlotXmin(TransactionId *xmin, TransactionId *catalog_xmin)
Definition: procarray.c:3968
VirtualTransactionId * GetCurrentVirtualXIDs(TransactionId limitXmin, bool excludeXmin0, bool allDbs, int excludeVacuum, int *nvxids)
Definition: procarray.c:3324
pid_t SignalVirtualTransaction(VirtualTransactionId vxid, ProcSignalReason sigmode, bool conflictPending)
Definition: procarray.c:3497
Size ProcArrayShmemSize(void)
Definition: procarray.c:376
TransactionId GetOldestSafeDecodingTransactionId(bool catalogOnly)
Definition: procarray.c:2945
void XidCacheRemoveRunningXids(TransactionId xid, int nxids, const TransactionId *xids, TransactionId latestXid)
Definition: procarray.c:3991
bool TransactionIdIsActive(TransactionId xid)
Definition: procarray.c:1634
bool MinimumActiveBackends(int min)
Definition: procarray.c:3546
void TerminateOtherDBBackends(Oid databaseId)
Definition: procarray.c:3828
void ExpireAllKnownAssignedTransactionIds(void)
Definition: procarray.c:4498
RunningTransactions GetRunningTransactionData(void)
Definition: procarray.c:2689
TransactionId GetOldestActiveTransactionId(void)
Definition: procarray.c:2880
void ProcArrayEndTransaction(PGPROC *proc, TransactionId latestXid)
Definition: procarray.c:667
void RecordKnownAssignedTransactionIds(TransactionId xid)
Definition: procarray.c:4403
TransactionId GetOldestTransactionIdConsideredRunning(void)
Definition: procarray.c:2034
int GetMaxSnapshotSubxidCount(void)
Definition: procarray.c:2080
int CountDBConnections(Oid databaseid)
Definition: procarray.c:3628
void CancelDBBackends(Oid databaseid, ProcSignalReason sigmode, bool conflictPending)
Definition: procarray.c:3659
void GetReplicationHorizons(TransactionId *xmin, TransactionId *catalog_xmin)
Definition: procarray.c:2047
void ProcArrayAdd(PGPROC *proc)
Definition: procarray.c:468
pid_t CancelVirtualTransaction(VirtualTransactionId vxid, ProcSignalReason sigmode)
Definition: procarray.c:3491
Snapshot GetSnapshotData(Snapshot snapshot)
Definition: procarray.c:2175
bool HaveVirtualXIDsDelayingChkpt(VirtualTransactionId *vxids, int nvxids, int type)
Definition: procarray.c:3089
void KnownAssignedTransactionIdsIdleMaintenance(void)
Definition: procarray.c:4540
int GetMaxSnapshotXidCount(void)
Definition: procarray.c:2069
int CountDBBackends(Oid databaseid)
Definition: procarray.c:3599
PGPROC * BackendPidGetProcWithLock(int pid)
Definition: procarray.c:3219
PGPROC * BackendPidGetProc(int pid)
Definition: procarray.c:3196
bool ProcArrayInstallRestoredXmin(TransactionId xmin, PGPROC *proc)
Definition: procarray.c:2616
void ProcArrayApplyRecoveryInfo(RunningTransactions running)
Definition: procarray.c:1054
void ProcArrayClearTransaction(PGPROC *proc)
Definition: procarray.c:907
void ProcNumberGetTransactionIds(int procNumber, TransactionId *xid, TransactionId *xmin, int *nsubxid, bool *overflowed)
Definition: procarray.c:3160
int CountUserBackends(Oid roleid)
Definition: procarray.c:3700
void ProcArrayApplyXidAssignment(TransactionId topxid, int nsubxids, TransactionId *subxids)
Definition: procarray.c:1318
void ProcArrayShmemInit(void)
Definition: procarray.c:418
bool CountOtherDBBackends(Oid databaseId, int *nbackends, int *nprepared)
Definition: procarray.c:3750
PGPROC * ProcNumberGetProc(int procNumber)
Definition: procarray.c:3138
int BackendXidGetPid(TransactionId xid)
Definition: procarray.c:3256
bool IsBackendPid(int pid)
Definition: procarray.c:3291
void ProcArraySetReplicationSlotXmin(TransactionId xmin, TransactionId catalog_xmin, bool already_locked)
Definition: procarray.c:3943
void ProcArrayInitRecovery(TransactionId initializedUptoXID)
Definition: procarray.c:1023
void ProcArrayRemove(PGPROC *proc, TransactionId latestXid)
Definition: procarray.c:565
VirtualTransactionId * GetConflictingVirtualXIDs(TransactionId limitXmin, Oid dbOid)
Definition: procarray.c:3417
void ExpireTreeKnownAssignedTransactionIds(TransactionId xid, int nsubxids, TransactionId *subxids, TransactionId max_xid)
Definition: procarray.c:4472
VirtualTransactionId * GetVirtualXIDsDelayingChkpt(int *nvxids, int type)
Definition: procarray.c:3043
bool ProcArrayInstallImportedXmin(TransactionId xmin, VirtualTransactionId *sourcevxid)
Definition: procarray.c:2532
bool TransactionIdIsInProgress(TransactionId xid)
Definition: procarray.c:1402
void ExpireOldKnownAssignedTransactionIds(TransactionId xid)
Definition: procarray.c:4518
ProcSignalReason
Definition: procsignal.h:31
Definition: proc.h:162
const char * type