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 "storage/lock.h"
18 #include "utils/relcache.h"
19 #include "utils/snapshot.h"
20 
21 
22 /*
23  * GUC variables
24  */
28 
29 
30 /* Number of SLRU buffers to use for predicate locking */
31 #define NUM_OLDSERXID_BUFFERS 16
32 
33 
34 /*
35  * function prototypes
36  */
37 
38 /* housekeeping for shared memory predicate lock structures */
39 extern void InitPredicateLocks(void);
40 extern Size PredicateLockShmemSize(void);
41 
42 extern void CheckPointPredicate(void);
43 
44 /* predicate lock reporting */
45 extern bool PageIsPredicateLocked(Relation relation, BlockNumber blkno);
46 
47 /* predicate lock maintenance */
49 extern void SetSerializableTransactionSnapshot(Snapshot snapshot,
50  VirtualTransactionId *sourcevxid,
51  int sourcepid);
53 extern void PredicateLockRelation(Relation relation, Snapshot snapshot);
54 extern void PredicateLockPage(Relation relation, BlockNumber blkno, Snapshot snapshot);
55 extern void PredicateLockTuple(Relation relation, HeapTuple tuple, Snapshot snapshot);
56 extern void PredicateLockPageSplit(Relation relation, BlockNumber oldblkno, BlockNumber newblkno);
57 extern void PredicateLockPageCombine(Relation relation, BlockNumber oldblkno, BlockNumber newblkno);
59 extern void ReleasePredicateLocks(bool isCommit);
60 
61 /* conflict detection (may also trigger rollback) */
62 extern void CheckForSerializableConflictOut(bool valid, Relation relation, HeapTuple tuple,
63  Buffer buffer, Snapshot snapshot);
64 extern void CheckForSerializableConflictIn(Relation relation, HeapTuple tuple, Buffer buffer);
65 extern void CheckTableForSerializableConflictIn(Relation relation);
66 
67 /* final rollback checking */
69 
70 /* two-phase commit support */
71 extern void AtPrepare_PredicateLocks(void);
73 extern void PredicateLockTwoPhaseFinish(TransactionId xid, bool isCommit);
75  void *recdata, uint32 len);
76 
77 #endif /* PREDICATE_H */
bool PageIsPredicateLocked(Relation relation, BlockNumber blkno)
Definition: predicate.c:1927
void CheckForSerializableConflictIn(Relation relation, HeapTuple tuple, Buffer buffer)
Definition: predicate.c:4324
uint32 TransactionId
Definition: c.h:397
void CheckForSerializableConflictOut(bool valid, Relation relation, HeapTuple tuple, Buffer buffer, Snapshot snapshot)
Definition: predicate.c:3943
void RegisterPredicateLockingXid(TransactionId xid)
Definition: predicate.c:1878
uint32 BlockNumber
Definition: block.h:31
void PredicateLockPage(Relation relation, BlockNumber blkno, Snapshot snapshot)
Definition: predicate.c:2519
void CheckPointPredicate(void)
Definition: predicate.c:1041
Snapshot GetSerializableTransactionSnapshot(Snapshot snapshot)
Definition: predicate.c:1634
void CheckTableForSerializableConflictIn(Relation relation)
Definition: predicate.c:4408
unsigned short uint16
Definition: c.h:267
void PredicateLockTuple(Relation relation, HeapTuple tuple, Snapshot snapshot)
Definition: predicate.c:2541
Size PredicateLockShmemSize(void)
Definition: predicate.c:1309
void ReleasePredicateLocks(bool isCommit)
Definition: predicate.c:3266
unsigned int uint32
Definition: c.h:268
int max_predicate_locks_per_xact
Definition: predicate.c:361
void PredicateLockPageSplit(Relation relation, BlockNumber oldblkno, BlockNumber newblkno)
Definition: predicate.c:3109
int max_predicate_locks_per_relation
Definition: predicate.c:362
void PostPrepare_PredicateLocks(TransactionId xid)
Definition: predicate.c:4872
int max_predicate_locks_per_page
Definition: predicate.c:363
void PredicateLockPageCombine(Relation relation, BlockNumber oldblkno, BlockNumber newblkno)
Definition: predicate.c:3194
void SetSerializableTransactionSnapshot(Snapshot snapshot, VirtualTransactionId *sourcevxid, int sourcepid)
Definition: predicate.c:1674
void InitPredicateLocks(void)
Definition: predicate.c:1106
void PredicateLockTwoPhaseFinish(TransactionId xid, bool isCommit)
Definition: predicate.c:4894
WalTimeSample buffer[LAG_TRACKER_BUFFER_SIZE]
Definition: walsender.c:214
void PreCommit_CheckForSerializationFailure(void)
Definition: predicate.c:4710
size_t Size
Definition: c.h:356
void TransferPredicateLocksToHeapRelation(Relation relation)
Definition: predicate.c:3088
void predicatelock_twophase_recover(TransactionId xid, uint16 info, void *recdata, uint32 len)
Definition: predicate.c:4921
void PredicateLockRelation(Relation relation, Snapshot snapshot)
Definition: predicate.c:2496
int Buffer
Definition: buf.h:23
void AtPrepare_PredicateLocks(void)
Definition: predicate.c:4803