PostgreSQL Source Code  git master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
predicate.h
Go to the documentation of this file.
1 /*-------------------------------------------------------------------------
2  *
3  * predicate.h
4  * POSTGRES public predicate locking 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/predicate.h
11  *
12  *-------------------------------------------------------------------------
13  */
14 #ifndef PREDICATE_H
15 #define PREDICATE_H
16 
17 #include "utils/relcache.h"
18 #include "utils/snapshot.h"
19 
20 
21 /*
22  * GUC variables
23  */
25 
26 
27 /* Number of SLRU buffers to use for predicate locking */
28 #define NUM_OLDSERXID_BUFFERS 16
29 
30 
31 /*
32  * function prototypes
33  */
34 
35 /* housekeeping for shared memory predicate lock structures */
36 extern void InitPredicateLocks(void);
37 extern Size PredicateLockShmemSize(void);
38 
39 extern void CheckPointPredicate(void);
40 
41 /* predicate lock reporting */
42 extern bool PageIsPredicateLocked(Relation relation, BlockNumber blkno);
43 
44 /* predicate lock maintenance */
46 extern void SetSerializableTransactionSnapshot(Snapshot snapshot,
47  TransactionId sourcexid);
49 extern void PredicateLockRelation(Relation relation, Snapshot snapshot);
50 extern void PredicateLockPage(Relation relation, BlockNumber blkno, Snapshot snapshot);
51 extern void PredicateLockTuple(Relation relation, HeapTuple tuple, Snapshot snapshot);
52 extern void PredicateLockPageSplit(Relation relation, BlockNumber oldblkno, BlockNumber newblkno);
53 extern void PredicateLockPageCombine(Relation relation, BlockNumber oldblkno, BlockNumber newblkno);
55 extern void ReleasePredicateLocks(bool isCommit);
56 
57 /* conflict detection (may also trigger rollback) */
58 extern void CheckForSerializableConflictOut(bool valid, Relation relation, HeapTuple tuple,
59  Buffer buffer, Snapshot snapshot);
60 extern void CheckForSerializableConflictIn(Relation relation, HeapTuple tuple, Buffer buffer);
61 extern void CheckTableForSerializableConflictIn(Relation relation);
62 
63 /* final rollback checking */
65 
66 /* two-phase commit support */
67 extern void AtPrepare_PredicateLocks(void);
69 extern void PredicateLockTwoPhaseFinish(TransactionId xid, bool isCommit);
71  void *recdata, uint32 len);
72 
73 #endif /* PREDICATE_H */
bool PageIsPredicateLocked(Relation relation, BlockNumber blkno)
Definition: predicate.c:1853
void CheckForSerializableConflictIn(Relation relation, HeapTuple tuple, Buffer buffer)
Definition: predicate.c:4243
uint32 TransactionId
Definition: c.h:394
void CheckForSerializableConflictOut(bool valid, Relation relation, HeapTuple tuple, Buffer buffer, Snapshot snapshot)
Definition: predicate.c:3862
void RegisterPredicateLockingXid(TransactionId xid)
Definition: predicate.c:1804
uint32 BlockNumber
Definition: block.h:31
void PredicateLockPage(Relation relation, BlockNumber blkno, Snapshot snapshot)
Definition: predicate.c:2438
void CheckPointPredicate(void)
Definition: predicate.c:1032
Snapshot GetSerializableTransactionSnapshot(Snapshot snapshot)
Definition: predicate.c:1563
void CheckTableForSerializableConflictIn(Relation relation)
Definition: predicate.c:4327
unsigned short uint16
Definition: c.h:264
void PredicateLockTuple(Relation relation, HeapTuple tuple, Snapshot snapshot)
Definition: predicate.c:2460
Size PredicateLockShmemSize(void)
Definition: predicate.c:1288
void ReleasePredicateLocks(bool isCommit)
Definition: predicate.c:3185
unsigned int uint32
Definition: c.h:265
int max_predicate_locks_per_xact
Definition: predicate.c:356
void PredicateLockPageSplit(Relation relation, BlockNumber oldblkno, BlockNumber newblkno)
Definition: predicate.c:3028
void PostPrepare_PredicateLocks(TransactionId xid)
Definition: predicate.c:4791
void PredicateLockPageCombine(Relation relation, BlockNumber oldblkno, BlockNumber newblkno)
Definition: predicate.c:3113
void InitPredicateLocks(void)
Definition: predicate.c:1097
void PredicateLockTwoPhaseFinish(TransactionId xid, bool isCommit)
Definition: predicate.c:4813
void PreCommit_CheckForSerializationFailure(void)
Definition: predicate.c:4629
size_t Size
Definition: c.h:353
void TransferPredicateLocksToHeapRelation(Relation relation)
Definition: predicate.c:3007
void predicatelock_twophase_recover(TransactionId xid, uint16 info, void *recdata, uint32 len)
Definition: predicate.c:4840
void SetSerializableTransactionSnapshot(Snapshot snapshot, TransactionId sourcexid)
Definition: predicate.c:1603
void PredicateLockRelation(Relation relation, Snapshot snapshot)
Definition: predicate.c:2415
int Buffer
Definition: buf.h:23
void AtPrepare_PredicateLocks(void)
Definition: predicate.c:4722