PostgreSQL Source Code  git master
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-2022, 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 
23 extern Size ProcArrayShmemSize(void);
24 extern void CreateSharedProcArray(void);
25 extern void ProcArrayAdd(PGPROC *proc);
26 extern void ProcArrayRemove(PGPROC *proc, TransactionId latestXid);
27 
28 extern void ProcArrayEndTransaction(PGPROC *proc, TransactionId latestXid);
29 extern void ProcArrayClearTransaction(PGPROC *proc);
30 
31 extern void ProcArrayInitRecovery(TransactionId initializedUptoXID);
34  int nsubxids, TransactionId *subxids);
35 
38  int nsubxids, TransactionId *subxids,
39  TransactionId max_xid);
40 extern void ExpireAllKnownAssignedTransactionIds(void);
42 
43 extern int GetMaxSnapshotXidCount(void);
44 extern int GetMaxSnapshotSubxidCount(void);
45 
46 extern Snapshot GetSnapshotData(Snapshot snapshot);
47 
49  VirtualTransactionId *sourcevxid);
50 extern bool ProcArrayInstallRestoredXmin(TransactionId xmin, PGPROC *proc);
51 
53 
55 extern bool TransactionIdIsActive(TransactionId xid);
59 extern TransactionId GetOldestSafeDecodingTransactionId(bool catalogOnly);
60 extern void GetReplicationHorizons(TransactionId *slot_xmin, TransactionId *catalog_xmin);
61 
62 extern VirtualTransactionId *GetVirtualXIDsDelayingChkpt(int *nvxids, int type);
64  int nvxids, int type);
65 
66 extern PGPROC *BackendPidGetProc(int pid);
67 extern PGPROC *BackendPidGetProcWithLock(int pid);
68 extern int BackendXidGetPid(TransactionId xid);
69 extern bool IsBackendPid(int pid);
70 
72  bool excludeXmin0, bool allDbs, int excludeVacuum,
73  int *nvxids);
77  bool conflictPending);
78 
79 extern bool MinimumActiveBackends(int min);
80 extern int CountDBBackends(Oid databaseid);
81 extern int CountDBConnections(Oid databaseid);
82 extern void CancelDBBackends(Oid databaseid, ProcSignalReason sigmode, bool conflictPending);
83 extern int CountUserBackends(Oid roleid);
84 extern bool CountOtherDBBackends(Oid databaseId,
85  int *nbackends, int *nprepared);
86 extern void TerminateOtherDBBackends(Oid databaseId);
87 
89  int nxids, const TransactionId *xids,
90  TransactionId latestXid);
91 
93  TransactionId catalog_xmin, bool already_locked);
94 
96  TransactionId *catalog_xmin);
97 
98 #endif /* PROCARRAY_H */
uint32 TransactionId
Definition: c.h:587
size_t Size
Definition: c.h:540
unsigned int Oid
Definition: postgres_ext.h:31
TransactionId GetOldestNonRemovableTransactionId(Relation rel)
Definition: procarray.c:2021
VirtualTransactionId * GetVirtualXIDsDelayingChkpt(int *nvxids, int type)
Definition: procarray.c:3075
void ProcArrayGetReplicationSlotXmin(TransactionId *xmin, TransactionId *catalog_xmin)
Definition: procarray.c:3927
pid_t SignalVirtualTransaction(VirtualTransactionId vxid, ProcSignalReason sigmode, bool conflictPending)
Definition: procarray.c:3466
Size ProcArrayShmemSize(void)
Definition: procarray.c:362
TransactionId GetOldestSafeDecodingTransactionId(bool catalogOnly)
Definition: procarray.c:2977
void XidCacheRemoveRunningXids(TransactionId xid, int nxids, const TransactionId *xids, TransactionId latestXid)
Definition: procarray.c:3950
bool TransactionIdIsActive(TransactionId xid)
Definition: procarray.c:1601
bool MinimumActiveBackends(int min)
Definition: procarray.c:3515
void TerminateOtherDBBackends(Oid databaseId)
Definition: procarray.c:3797
void ExpireAllKnownAssignedTransactionIds(void)
Definition: procarray.c:4487
VirtualTransactionId * GetConflictingVirtualXIDs(TransactionId limitXmin, Oid dbOid)
Definition: procarray.c:3386
void GetReplicationHorizons(TransactionId *slot_xmin, TransactionId *catalog_xmin)
Definition: procarray.c:2063
RunningTransactions GetRunningTransactionData(void)
Definition: procarray.c:2737
TransactionId GetOldestActiveTransactionId(void)
Definition: procarray.c:2912
void ProcArrayEndTransaction(PGPROC *proc, TransactionId latestXid)
Definition: procarray.c:653
void RecordKnownAssignedTransactionIds(TransactionId xid)
Definition: procarray.c:4392
TransactionId GetOldestTransactionIdConsideredRunning(void)
Definition: procarray.c:2050
int GetMaxSnapshotSubxidCount(void)
Definition: procarray.c:2096
int CountDBConnections(Oid databaseid)
Definition: procarray.c:3598
void CancelDBBackends(Oid databaseid, ProcSignalReason sigmode, bool conflictPending)
Definition: procarray.c:3629
void ProcArrayAdd(PGPROC *proc)
Definition: procarray.c:455
pid_t CancelVirtualTransaction(VirtualTransactionId vxid, ProcSignalReason sigmode)
Definition: procarray.c:3460
Snapshot GetSnapshotData(Snapshot snapshot)
Definition: procarray.c:2222
bool HaveVirtualXIDsDelayingChkpt(VirtualTransactionId *vxids, int nvxids, int type)
Definition: procarray.c:3121
int GetMaxSnapshotXidCount(void)
Definition: procarray.c:2085
int CountDBBackends(Oid databaseid)
Definition: procarray.c:3568
bool ProcArrayInstallRestoredXmin(TransactionId xmin, PGPROC *proc)
Definition: procarray.c:2664
void CreateSharedProcArray(void)
Definition: procarray.c:404
void ProcArrayApplyRecoveryInfo(RunningTransactions running)
Definition: procarray.c:1039
void ProcArrayClearTransaction(PGPROC *proc)
Definition: procarray.c:892
VirtualTransactionId * GetCurrentVirtualXIDs(TransactionId limitXmin, bool excludeXmin0, bool allDbs, int excludeVacuum, int *nvxids)
Definition: procarray.c:3298
int CountUserBackends(Oid roleid)
Definition: procarray.c:3669
PGPROC * BackendPidGetProc(int pid)
Definition: procarray.c:3170
PGPROC * BackendPidGetProcWithLock(int pid)
Definition: procarray.c:3193
void ProcArrayApplyXidAssignment(TransactionId topxid, int nsubxids, TransactionId *subxids)
Definition: procarray.c:1285
bool CountOtherDBBackends(Oid databaseId, int *nbackends, int *nprepared)
Definition: procarray.c:3719
int BackendXidGetPid(TransactionId xid)
Definition: procarray.c:3230
bool IsBackendPid(int pid)
Definition: procarray.c:3265
void ProcArraySetReplicationSlotXmin(TransactionId xmin, TransactionId catalog_xmin, bool already_locked)
Definition: procarray.c:3905
void ProcArrayInitRecovery(TransactionId initializedUptoXID)
Definition: procarray.c:1008
void ProcArrayRemove(PGPROC *proc, TransactionId latestXid)
Definition: procarray.c:551
void ExpireTreeKnownAssignedTransactionIds(TransactionId xid, int nsubxids, TransactionId *subxids, TransactionId max_xid)
Definition: procarray.c:4461
bool ProcArrayInstallImportedXmin(TransactionId xmin, VirtualTransactionId *sourcevxid)
Definition: procarray.c:2585
bool TransactionIdIsInProgress(TransactionId xid)
Definition: procarray.c:1369
void ExpireOldKnownAssignedTransactionIds(TransactionId xid)
Definition: procarray.c:4507
ProcSignalReason
Definition: procsignal.h:31
Definition: proc.h:160