Fix indentation in twophase.c
[pgsql.git] / src / include / storage / procarray.h
blobd8cae3ce1c52154a320e444225a6095ceb32be3e
1 /*-------------------------------------------------------------------------
3 * procarray.h
4 * POSTGRES process array definitions.
7 * Portions Copyright (c) 1996-2023, PostgreSQL Global Development Group
8 * Portions Copyright (c) 1994, Regents of the University of California
10 * src/include/storage/procarray.h
12 *-------------------------------------------------------------------------
14 #ifndef PROCARRAY_H
15 #define PROCARRAY_H
17 #include "storage/lock.h"
18 #include "storage/standby.h"
19 #include "utils/relcache.h"
20 #include "utils/snapshot.h"
23 extern Size ProcArrayShmemSize(void);
24 extern void CreateSharedProcArray(void);
25 extern void ProcArrayAdd(PGPROC *proc);
26 extern void ProcArrayRemove(PGPROC *proc, TransactionId latestXid);
28 extern void ProcArrayEndTransaction(PGPROC *proc, TransactionId latestXid);
29 extern void ProcArrayClearTransaction(PGPROC *proc);
31 extern void ProcArrayInitRecovery(TransactionId initializedUptoXID);
32 extern void ProcArrayApplyRecoveryInfo(RunningTransactions running);
33 extern void ProcArrayApplyXidAssignment(TransactionId topxid,
34 int nsubxids, TransactionId *subxids);
36 extern void RecordKnownAssignedTransactionIds(TransactionId xid);
37 extern void ExpireTreeKnownAssignedTransactionIds(TransactionId xid,
38 int nsubxids, TransactionId *subxids,
39 TransactionId max_xid);
40 extern void ExpireAllKnownAssignedTransactionIds(void);
41 extern void ExpireOldKnownAssignedTransactionIds(TransactionId xid);
42 extern void KnownAssignedTransactionIdsIdleMaintenance(void);
44 extern int GetMaxSnapshotXidCount(void);
45 extern int GetMaxSnapshotSubxidCount(void);
47 extern Snapshot GetSnapshotData(Snapshot snapshot);
49 extern bool ProcArrayInstallImportedXmin(TransactionId xmin,
50 VirtualTransactionId *sourcevxid);
51 extern bool ProcArrayInstallRestoredXmin(TransactionId xmin, PGPROC *proc);
53 extern RunningTransactions GetRunningTransactionData(void);
55 extern bool TransactionIdIsInProgress(TransactionId xid);
56 extern bool TransactionIdIsActive(TransactionId xid);
57 extern TransactionId GetOldestNonRemovableTransactionId(Relation rel);
58 extern TransactionId GetOldestTransactionIdConsideredRunning(void);
59 extern TransactionId GetOldestActiveTransactionId(void);
60 extern TransactionId GetOldestSafeDecodingTransactionId(bool catalogOnly);
61 extern void GetReplicationHorizons(TransactionId *xmin, TransactionId *catalog_xmin);
63 extern VirtualTransactionId *GetVirtualXIDsDelayingChkpt(int *nvxids, int type);
64 extern bool HaveVirtualXIDsDelayingChkpt(VirtualTransactionId *vxids,
65 int nvxids, int type);
67 extern PGPROC *BackendPidGetProc(int pid);
68 extern PGPROC *BackendPidGetProcWithLock(int pid);
69 extern int BackendXidGetPid(TransactionId xid);
70 extern bool IsBackendPid(int pid);
72 extern VirtualTransactionId *GetCurrentVirtualXIDs(TransactionId limitXmin,
73 bool excludeXmin0, bool allDbs, int excludeVacuum,
74 int *nvxids);
75 extern VirtualTransactionId *GetConflictingVirtualXIDs(TransactionId limitXmin, Oid dbOid);
76 extern pid_t CancelVirtualTransaction(VirtualTransactionId vxid, ProcSignalReason sigmode);
77 extern pid_t SignalVirtualTransaction(VirtualTransactionId vxid, ProcSignalReason sigmode,
78 bool conflictPending);
80 extern bool MinimumActiveBackends(int min);
81 extern int CountDBBackends(Oid databaseid);
82 extern int CountDBConnections(Oid databaseid);
83 extern void CancelDBBackends(Oid databaseid, ProcSignalReason sigmode, bool conflictPending);
84 extern int CountUserBackends(Oid roleid);
85 extern bool CountOtherDBBackends(Oid databaseId,
86 int *nbackends, int *nprepared);
87 extern void TerminateOtherDBBackends(Oid databaseId);
89 extern void XidCacheRemoveRunningXids(TransactionId xid,
90 int nxids, const TransactionId *xids,
91 TransactionId latestXid);
93 extern void ProcArraySetReplicationSlotXmin(TransactionId xmin,
94 TransactionId catalog_xmin, bool already_locked);
96 extern void ProcArrayGetReplicationSlotXmin(TransactionId *xmin,
97 TransactionId *catalog_xmin);
99 #endif /* PROCARRAY_H */