gooderp18绿色标准版
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

128 行
5.1KB

  1. /*-------------------------------------------------------------------------
  2. *
  3. * procarray.h
  4. * POSTGRES process array definitions.
  5. *
  6. *
  7. * Portions Copyright (c) 1996-2019, 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. #include "storage/lock.h"
  17. #include "storage/standby.h"
  18. #include "utils/relcache.h"
  19. #include "utils/snapshot.h"
  20. /*
  21. * These are to implement PROCARRAY_FLAGS_XXX
  22. *
  23. * Note: These flags are cloned from PROC_XXX flags in src/include/storage/proc.h
  24. * to avoid forcing to include proc.h when including procarray.h. So if you modify
  25. * PROC_XXX flags, you need to modify these flags.
  26. */
  27. #define PROCARRAY_VACUUM_FLAG 0x02 /* currently running lazy
  28. * vacuum */
  29. #define PROCARRAY_ANALYZE_FLAG 0x04 /* currently running
  30. * analyze */
  31. #define PROCARRAY_LOGICAL_DECODING_FLAG 0x10 /* currently doing logical
  32. * decoding outside xact */
  33. #define PROCARRAY_SLOTS_XMIN 0x20 /* replication slot xmin,
  34. * catalog_xmin */
  35. /*
  36. * Only flags in PROCARRAY_PROC_FLAGS_MASK are considered when matching
  37. * PGXACT->vacuumFlags. Other flags are used for different purposes and
  38. * have no corresponding PROC flag equivalent.
  39. */
  40. #define PROCARRAY_PROC_FLAGS_MASK (PROCARRAY_VACUUM_FLAG | \
  41. PROCARRAY_ANALYZE_FLAG | \
  42. PROCARRAY_LOGICAL_DECODING_FLAG)
  43. /* Use the following flags as an input "flags" to GetOldestXmin function */
  44. /* Consider all backends except for logical decoding ones which manage xmin separately */
  45. #define PROCARRAY_FLAGS_DEFAULT PROCARRAY_LOGICAL_DECODING_FLAG
  46. /* Ignore vacuum backends */
  47. #define PROCARRAY_FLAGS_VACUUM PROCARRAY_FLAGS_DEFAULT | PROCARRAY_VACUUM_FLAG
  48. /* Ignore analyze backends */
  49. #define PROCARRAY_FLAGS_ANALYZE PROCARRAY_FLAGS_DEFAULT | PROCARRAY_ANALYZE_FLAG
  50. /* Ignore both vacuum and analyze backends */
  51. #define PROCARRAY_FLAGS_VACUUM_ANALYZE PROCARRAY_FLAGS_DEFAULT | PROCARRAY_VACUUM_FLAG | PROCARRAY_ANALYZE_FLAG
  52. extern Size ProcArrayShmemSize(void);
  53. extern void CreateSharedProcArray(void);
  54. extern void ProcArrayAdd(PGPROC *proc);
  55. extern void ProcArrayRemove(PGPROC *proc, TransactionId latestXid);
  56. extern void ProcArrayEndTransaction(PGPROC *proc, TransactionId latestXid);
  57. extern void ProcArrayClearTransaction(PGPROC *proc);
  58. extern void ProcArrayInitRecovery(TransactionId initializedUptoXID);
  59. extern void ProcArrayApplyRecoveryInfo(RunningTransactions running);
  60. extern void ProcArrayApplyXidAssignment(TransactionId topxid,
  61. int nsubxids, TransactionId *subxids);
  62. extern void RecordKnownAssignedTransactionIds(TransactionId xid);
  63. extern void ExpireTreeKnownAssignedTransactionIds(TransactionId xid,
  64. int nsubxids, TransactionId *subxids,
  65. TransactionId max_xid);
  66. extern void ExpireAllKnownAssignedTransactionIds(void);
  67. extern void ExpireOldKnownAssignedTransactionIds(TransactionId xid);
  68. extern int GetMaxSnapshotXidCount(void);
  69. extern int GetMaxSnapshotSubxidCount(void);
  70. extern Snapshot GetSnapshotData(Snapshot snapshot);
  71. extern bool ProcArrayInstallImportedXmin(TransactionId xmin,
  72. VirtualTransactionId *sourcevxid);
  73. extern bool ProcArrayInstallRestoredXmin(TransactionId xmin, PGPROC *proc);
  74. extern RunningTransactions GetRunningTransactionData(void);
  75. extern bool TransactionIdIsInProgress(TransactionId xid);
  76. extern bool TransactionIdIsActive(TransactionId xid);
  77. extern TransactionId GetOldestXmin(Relation rel, int flags);
  78. extern TransactionId GetOldestActiveTransactionId(void);
  79. extern TransactionId GetOldestSafeDecodingTransactionId(bool catalogOnly);
  80. extern VirtualTransactionId *GetVirtualXIDsDelayingChkpt(int *nvxids);
  81. extern bool HaveVirtualXIDsDelayingChkpt(VirtualTransactionId *vxids, int nvxids);
  82. extern PGPROC *BackendPidGetProc(int pid);
  83. extern PGPROC *BackendPidGetProcWithLock(int pid);
  84. extern int BackendXidGetPid(TransactionId xid);
  85. extern bool IsBackendPid(int pid);
  86. extern VirtualTransactionId *GetCurrentVirtualXIDs(TransactionId limitXmin,
  87. bool excludeXmin0, bool allDbs, int excludeVacuum,
  88. int *nvxids);
  89. extern VirtualTransactionId *GetConflictingVirtualXIDs(TransactionId limitXmin, Oid dbOid);
  90. extern pid_t CancelVirtualTransaction(VirtualTransactionId vxid, ProcSignalReason sigmode);
  91. extern bool MinimumActiveBackends(int min);
  92. extern int CountDBBackends(Oid databaseid);
  93. extern int CountDBConnections(Oid databaseid);
  94. extern void CancelDBBackends(Oid databaseid, ProcSignalReason sigmode, bool conflictPending);
  95. extern int CountUserBackends(Oid roleid);
  96. extern bool CountOtherDBBackends(Oid databaseId,
  97. int *nbackends, int *nprepared);
  98. extern void XidCacheRemoveRunningXids(TransactionId xid,
  99. int nxids, const TransactionId *xids,
  100. TransactionId latestXid);
  101. extern void ProcArraySetReplicationSlotXmin(TransactionId xmin,
  102. TransactionId catalog_xmin, bool already_locked);
  103. extern void ProcArrayGetReplicationSlotXmin(TransactionId *xmin,
  104. TransactionId *catalog_xmin);
  105. #endif /* PROCARRAY_H */
上海开阖软件有限公司 沪ICP备12045867号-1