PostgreSQL Source Code  git master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
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-2017, 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  TransactionId sourcexid);
50 extern bool ProcArrayInstallRestoredXmin(TransactionId xmin, PGPROC *proc);
51 
53 
55 extern bool TransactionIdIsActive(TransactionId xid);
56 extern TransactionId GetOldestXmin(Relation rel, bool ignoreVacuum);
59 
61 extern bool HaveVirtualXIDsDelayingChkpt(VirtualTransactionId *vxids, int nvxids);
62 
63 extern PGPROC *BackendPidGetProc(int pid);
64 extern PGPROC *BackendPidGetProcWithLock(int pid);
65 extern int BackendXidGetPid(TransactionId xid);
66 extern bool IsBackendPid(int pid);
67 
69  bool excludeXmin0, bool allDbs, int excludeVacuum,
70  int *nvxids);
73 
74 extern bool MinimumActiveBackends(int min);
75 extern int CountDBBackends(Oid databaseid);
76 extern int CountDBConnections(Oid databaseid);
77 extern void CancelDBBackends(Oid databaseid, ProcSignalReason sigmode, bool conflictPending);
78 extern int CountUserBackends(Oid roleid);
79 extern bool CountOtherDBBackends(Oid databaseId,
80  int *nbackends, int *nprepared);
81 
83  int nxids, const TransactionId *xids,
84  TransactionId latestXid);
85 
87  TransactionId catalog_xmin, bool already_locked);
88 
90  TransactionId *catalog_xmin);
91 
92 #endif /* PROCARRAY_H */
bool TransactionIdIsActive(TransactionId xid)
Definition: procarray.c:1212
void ProcArrayInitRecovery(TransactionId initializedUptoXID)
Definition: procarray.c:633
bool IsBackendPid(int pid)
Definition: procarray.c:2424
uint32 TransactionId
Definition: c.h:393
void ProcArraySetReplicationSlotXmin(TransactionId xmin, TransactionId catalog_xmin, bool already_locked)
Definition: procarray.c:2947
PGPROC * BackendPidGetProcWithLock(int pid)
Definition: procarray.c:2352
void CreateSharedProcArray(void)
Definition: procarray.c:220
bool ProcArrayInstallRestoredXmin(TransactionId xmin, PGPROC *proc)
Definition: procarray.c:1863
Size ProcArrayShmemSize(void)
Definition: procarray.c:178
int BackendXidGetPid(TransactionId xid)
Definition: procarray.c:2389
int CountUserBackends(Oid roleid)
Definition: procarray.c:2823
TransactionId GetOldestSafeDecodingTransactionId(void)
Definition: procarray.c:2149
VirtualTransactionId * GetCurrentVirtualXIDs(TransactionId limitXmin, bool excludeXmin0, bool allDbs, int excludeVacuum, int *nvxids)
Definition: procarray.c:2457
unsigned int Oid
Definition: postgres_ext.h:31
int GetMaxSnapshotXidCount(void)
Definition: procarray.c:1451
void ExpireOldKnownAssignedTransactionIds(TransactionId xid)
Definition: procarray.c:3266
TransactionId GetOldestXmin(Relation rel, bool ignoreVacuum)
Definition: procarray.c:1305
int GetMaxSnapshotSubxidCount(void)
Definition: procarray.c:1462
RunningTransactions GetRunningTransactionData(void)
Definition: procarray.c:1925
bool HaveVirtualXIDsDelayingChkpt(VirtualTransactionId *vxids, int nvxids)
Definition: procarray.c:2282
Snapshot GetSnapshotData(Snapshot snapshot)
Definition: procarray.c:1503
void ProcArrayAdd(PGPROC *proc)
Definition: procarray.c:273
pid_t CancelVirtualTransaction(VirtualTransactionId vxid, ProcSignalReason sigmode)
Definition: procarray.c:2620
TransactionId GetOldestActiveTransactionId(void)
Definition: procarray.c:2083
void ProcArrayApplyXidAssignment(TransactionId topxid, int nsubxids, TransactionId *subxids)
Definition: procarray.c:911
bool CountOtherDBBackends(Oid databaseId, int *nbackends, int *nprepared)
Definition: procarray.c:2873
PGPROC * BackendPidGetProc(int pid)
Definition: procarray.c:2329
void ProcArrayApplyRecoveryInfo(RunningTransactions running)
Definition: procarray.c:664
bool ProcArrayInstallImportedXmin(TransactionId xmin, TransactionId sourcexid)
Definition: procarray.c:1791
int CountDBConnections(Oid databaseid)
Definition: procarray.c:2752
void XidCacheRemoveRunningXids(TransactionId xid, int nxids, const TransactionId *xids, TransactionId latestXid)
Definition: procarray.c:2999
void ProcArrayRemove(PGPROC *proc, TransactionId latestXid)
Definition: procarray.c:331
void ProcArrayEndTransaction(PGPROC *proc, TransactionId latestXid)
Definition: procarray.c:394
void RecordKnownAssignedTransactionIds(TransactionId xid)
Definition: procarray.c:3156
size_t Size
Definition: c.h:352
bool MinimumActiveBackends(int min)
Definition: procarray.c:2668
VirtualTransactionId * GetVirtualXIDsDelayingChkpt(int *nvxids)
Definition: procarray.c:2237
void ProcArrayClearTransaction(PGPROC *proc)
Definition: procarray.c:601
int CountDBBackends(Oid databaseid)
Definition: procarray.c:2722
void CancelDBBackends(Oid databaseid, ProcSignalReason sigmode, bool conflictPending)
Definition: procarray.c:2783
void ExpireTreeKnownAssignedTransactionIds(TransactionId xid, int nsubxids, TransactionId *subxids, TransactionId max_xid)
Definition: procarray.c:3229
ProcSignalReason
Definition: procsignal.h:30
void ProcArrayGetReplicationSlotXmin(TransactionId *xmin, TransactionId *catalog_xmin)
Definition: procarray.c:2969
void ExpireAllKnownAssignedTransactionIds(void)
Definition: procarray.c:3254
bool TransactionIdIsInProgress(TransactionId xid)
Definition: procarray.c:995
Definition: proc.h:84
VirtualTransactionId * GetConflictingVirtualXIDs(TransactionId limitXmin, Oid dbOid)
Definition: procarray.c:2545