Unmark gen_random_uuid() function leakproof.
[pgsql.git] / src / include / storage / predicate.h
blob5dca848cd8fb3d8b32a2c49f4e94ffa5471262cf
1 /*-------------------------------------------------------------------------
3 * predicate.h
4 * POSTGRES public predicate locking definitions.
7 * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group
8 * Portions Copyright (c) 1994, Regents of the University of California
10 * src/include/storage/predicate.h
12 *-------------------------------------------------------------------------
14 #ifndef PREDICATE_H
15 #define PREDICATE_H
17 #include "storage/itemptr.h"
18 #include "storage/lock.h"
19 #include "utils/relcache.h"
20 #include "utils/snapshot.h"
24 * GUC variables
26 extern PGDLLIMPORT int max_predicate_locks_per_xact;
27 extern PGDLLIMPORT int max_predicate_locks_per_relation;
28 extern PGDLLIMPORT int max_predicate_locks_per_page;
31 * A handle used for sharing SERIALIZABLEXACT objects between the participants
32 * in a parallel query.
34 typedef void *SerializableXactHandle;
37 * function prototypes
40 /* housekeeping for shared memory predicate lock structures */
41 extern void PredicateLockShmemInit(void);
42 extern Size PredicateLockShmemSize(void);
44 extern void CheckPointPredicate(void);
46 /* predicate lock reporting */
47 extern bool PageIsPredicateLocked(Relation relation, BlockNumber blkno);
49 /* predicate lock maintenance */
50 extern Snapshot GetSerializableTransactionSnapshot(Snapshot snapshot);
51 extern void SetSerializableTransactionSnapshot(Snapshot snapshot,
52 VirtualTransactionId *sourcevxid,
53 int sourcepid);
54 extern void RegisterPredicateLockingXid(TransactionId xid);
55 extern void PredicateLockRelation(Relation relation, Snapshot snapshot);
56 extern void PredicateLockPage(Relation relation, BlockNumber blkno, Snapshot snapshot);
57 extern void PredicateLockTID(Relation relation, ItemPointer tid, Snapshot snapshot,
58 TransactionId tuple_xid);
59 extern void PredicateLockPageSplit(Relation relation, BlockNumber oldblkno, BlockNumber newblkno);
60 extern void PredicateLockPageCombine(Relation relation, BlockNumber oldblkno, BlockNumber newblkno);
61 extern void TransferPredicateLocksToHeapRelation(Relation relation);
62 extern void ReleasePredicateLocks(bool isCommit, bool isReadOnlySafe);
64 /* conflict detection (may also trigger rollback) */
65 extern bool CheckForSerializableConflictOutNeeded(Relation relation, Snapshot snapshot);
66 extern void CheckForSerializableConflictOut(Relation relation, TransactionId xid, Snapshot snapshot);
67 extern void CheckForSerializableConflictIn(Relation relation, ItemPointer tid, BlockNumber blkno);
68 extern void CheckTableForSerializableConflictIn(Relation relation);
70 /* final rollback checking */
71 extern void PreCommit_CheckForSerializationFailure(void);
73 /* two-phase commit support */
74 extern void AtPrepare_PredicateLocks(void);
75 extern void PostPrepare_PredicateLocks(TransactionId xid);
76 extern void PredicateLockTwoPhaseFinish(TransactionId xid, bool isCommit);
77 extern void predicatelock_twophase_recover(TransactionId xid, uint16 info,
78 void *recdata, uint32 len);
80 /* parallel query support */
81 extern SerializableXactHandle ShareSerializableXact(void);
82 extern void AttachSerializableXact(SerializableXactHandle handle);
84 #endif /* PREDICATE_H */