gooderp18绿色标准版
Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

112 Zeilen
4.3KB

  1. /*-------------------------------------------------------------------------
  2. *
  3. * lmgr.h
  4. * POSTGRES lock manager 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/lmgr.h
  11. *
  12. *-------------------------------------------------------------------------
  13. */
  14. #ifndef LMGR_H
  15. #define LMGR_H
  16. #include "lib/stringinfo.h"
  17. #include "storage/itemptr.h"
  18. #include "storage/lock.h"
  19. #include "utils/rel.h"
  20. /* XactLockTableWait operations */
  21. typedef enum XLTW_Oper
  22. {
  23. XLTW_None,
  24. XLTW_Update,
  25. XLTW_Delete,
  26. XLTW_Lock,
  27. XLTW_LockUpdated,
  28. XLTW_InsertIndex,
  29. XLTW_InsertIndexUnique,
  30. XLTW_FetchUpdated,
  31. XLTW_RecheckExclusionConstr
  32. } XLTW_Oper;
  33. extern void RelationInitLockInfo(Relation relation);
  34. /* Lock a relation */
  35. extern void LockRelationOid(Oid relid, LOCKMODE lockmode);
  36. extern bool ConditionalLockRelationOid(Oid relid, LOCKMODE lockmode);
  37. extern void UnlockRelationId(LockRelId *relid, LOCKMODE lockmode);
  38. extern void UnlockRelationOid(Oid relid, LOCKMODE lockmode);
  39. extern void LockRelation(Relation relation, LOCKMODE lockmode);
  40. extern bool ConditionalLockRelation(Relation relation, LOCKMODE lockmode);
  41. extern void UnlockRelation(Relation relation, LOCKMODE lockmode);
  42. extern bool CheckRelationLockedByMe(Relation relation, LOCKMODE lockmode,
  43. bool orstronger);
  44. extern bool LockHasWaitersRelation(Relation relation, LOCKMODE lockmode);
  45. extern void LockRelationIdForSession(LockRelId *relid, LOCKMODE lockmode);
  46. extern void UnlockRelationIdForSession(LockRelId *relid, LOCKMODE lockmode);
  47. /* Lock a relation for extension */
  48. extern void LockRelationForExtension(Relation relation, LOCKMODE lockmode);
  49. extern void UnlockRelationForExtension(Relation relation, LOCKMODE lockmode);
  50. extern bool ConditionalLockRelationForExtension(Relation relation,
  51. LOCKMODE lockmode);
  52. extern int RelationExtensionLockWaiterCount(Relation relation);
  53. /* Lock a page (currently only used within indexes) */
  54. extern void LockPage(Relation relation, BlockNumber blkno, LOCKMODE lockmode);
  55. extern bool ConditionalLockPage(Relation relation, BlockNumber blkno, LOCKMODE lockmode);
  56. extern void UnlockPage(Relation relation, BlockNumber blkno, LOCKMODE lockmode);
  57. /* Lock a tuple (see heap_lock_tuple before assuming you understand this) */
  58. extern void LockTuple(Relation relation, ItemPointer tid, LOCKMODE lockmode);
  59. extern bool ConditionalLockTuple(Relation relation, ItemPointer tid,
  60. LOCKMODE lockmode);
  61. extern void UnlockTuple(Relation relation, ItemPointer tid, LOCKMODE lockmode);
  62. /* Lock an XID (used to wait for a transaction to finish) */
  63. extern void XactLockTableInsert(TransactionId xid);
  64. extern void XactLockTableDelete(TransactionId xid);
  65. extern void XactLockTableWait(TransactionId xid, Relation rel,
  66. ItemPointer ctid, XLTW_Oper oper);
  67. extern bool ConditionalXactLockTableWait(TransactionId xid);
  68. /* Lock VXIDs, specified by conflicting locktags */
  69. extern void WaitForLockers(LOCKTAG heaplocktag, LOCKMODE lockmode, bool progress);
  70. extern void WaitForLockersMultiple(List *locktags, LOCKMODE lockmode, bool progress);
  71. /* Lock an XID for tuple insertion (used to wait for an insertion to finish) */
  72. extern uint32 SpeculativeInsertionLockAcquire(TransactionId xid);
  73. extern void SpeculativeInsertionLockRelease(TransactionId xid);
  74. extern void SpeculativeInsertionWait(TransactionId xid, uint32 token);
  75. /* Lock a general object (other than a relation) of the current database */
  76. extern void LockDatabaseObject(Oid classid, Oid objid, uint16 objsubid,
  77. LOCKMODE lockmode);
  78. extern void UnlockDatabaseObject(Oid classid, Oid objid, uint16 objsubid,
  79. LOCKMODE lockmode);
  80. /* Lock a shared-across-databases object (other than a relation) */
  81. extern void LockSharedObject(Oid classid, Oid objid, uint16 objsubid,
  82. LOCKMODE lockmode);
  83. extern void UnlockSharedObject(Oid classid, Oid objid, uint16 objsubid,
  84. LOCKMODE lockmode);
  85. extern void LockSharedObjectForSession(Oid classid, Oid objid, uint16 objsubid,
  86. LOCKMODE lockmode);
  87. extern void UnlockSharedObjectForSession(Oid classid, Oid objid, uint16 objsubid,
  88. LOCKMODE lockmode);
  89. /* Describe a locktag for error messages */
  90. extern void DescribeLockTag(StringInfo buf, const LOCKTAG *tag);
  91. extern const char *GetLockNameFromTagType(uint16 locktag_type);
  92. #endif /* LMGR_H */
上海开阖软件有限公司 沪ICP备12045867号-1