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  */
27 
28 
29 /* Number of SLRU buffers to use for predicate locking */
30 #define NUM_OLDSERXID_BUFFERS 16
31 
32 
33 /*
34  * function prototypes
35  */
36 
37 /* housekeeping for shared memory predicate lock structures */
38 extern void InitPredicateLocks(void);
39 extern Size PredicateLockShmemSize(void);
40 
41 extern void CheckPointPredicate(void);
42 
43 /* predicate lock reporting */
44 extern bool PageIsPredicateLocked(Relation relation, BlockNumber blkno);
45 
46 /* predicate lock maintenance */
48 extern void SetSerializableTransactionSnapshot(Snapshot snapshot,
49  TransactionId sourcexid);
51 extern void PredicateLockRelation(Relation relation, Snapshot snapshot);
52 extern void PredicateLockPage(Relation relation, BlockNumber blkno, Snapshot snapshot);
53 extern void PredicateLockTuple(Relation relation, HeapTuple tuple, Snapshot snapshot);
54 extern void PredicateLockPageSplit(Relation relation, BlockNumber oldblkno, BlockNumber newblkno);
55 extern void PredicateLockPageCombine(Relation relation, BlockNumber oldblkno, BlockNumber newblkno);
57 extern void ReleasePredicateLocks(bool isCommit);
58 
59 /* conflict detection (may also trigger rollback) */
60 extern void CheckForSerializableConflictOut(bool valid, Relation relation, HeapTuple tuple,
61  Buffer buffer, Snapshot snapshot);
62 extern void CheckForSerializableConflictIn(Relation relation, HeapTuple tuple, Buffer buffer);
63 extern void CheckTableForSerializableConflictIn(Relation relation);
64 
65 /* final rollback checking */
67 
68 /* two-phase commit support */
69 extern void AtPrepare_PredicateLocks(void);
71 extern void PredicateLockTwoPhaseFinish(TransactionId xid, bool isCommit);
73  void *recdata, uint32 len);
74 
75 #endif /* PREDICATE_H */
bool PageIsPredicateLocked(Relation relation, BlockNumber blkno)
Definition: predicate.c:1910
void CheckForSerializableConflictIn(Relation relation, HeapTuple tuple, Buffer buffer)
Definition: predicate.c:4307
uint32 TransactionId
Definition: c.h:397
void CheckForSerializableConflictOut(bool valid, Relation relation, HeapTuple tuple, Buffer buffer, Snapshot snapshot)
Definition: predicate.c:3926
void RegisterPredicateLockingXid(TransactionId xid)
Definition: predicate.c:1861
uint32 BlockNumber
Definition: block.h:31
void PredicateLockPage(Relation relation, BlockNumber blkno, Snapshot snapshot)
Definition: predicate.c:2502
void CheckPointPredicate(void)
Definition: predicate.c:1039
Snapshot GetSerializableTransactionSnapshot(Snapshot snapshot)
Definition: predicate.c:1620
void CheckTableForSerializableConflictIn(Relation relation)
Definition: predicate.c:4391
unsigned short uint16
Definition: c.h:267
void PredicateLockTuple(Relation relation, HeapTuple tuple, Snapshot snapshot)
Definition: predicate.c:2524
Size PredicateLockShmemSize(void)
Definition: predicate.c:1295
void ReleasePredicateLocks(bool isCommit)
Definition: predicate.c:3249
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:3092
int max_predicate_locks_per_relation
Definition: predicate.c:362
void PostPrepare_PredicateLocks(TransactionId xid)
Definition: predicate.c:4855
int max_predicate_locks_per_page
Definition: predicate.c:363
void PredicateLockPageCombine(Relation relation, BlockNumber oldblkno, BlockNumber newblkno)
Definition: predicate.c:3177
void InitPredicateLocks(void)
Definition: predicate.c:1104
void PredicateLockTwoPhaseFinish(TransactionId xid, bool isCommit)
Definition: predicate.c:4877
WalTimeSample buffer[LAG_TRACKER_BUFFER_SIZE]
Definition: walsender.c:207
void PreCommit_CheckForSerializationFailure(void)
Definition: predicate.c:4693
size_t Size
Definition: c.h:356
void TransferPredicateLocksToHeapRelation(Relation relation)
Definition: predicate.c:3071
void predicatelock_twophase_recover(TransactionId xid, uint16 info, void *recdata, uint32 len)
Definition: predicate.c:4904
void SetSerializableTransactionSnapshot(Snapshot snapshot, TransactionId sourcexid)
Definition: predicate.c:1660
void PredicateLockRelation(Relation relation, Snapshot snapshot)
Definition: predicate.c:2479
int Buffer
Definition: buf.h:23
void AtPrepare_PredicateLocks(void)
Definition: predicate.c:4786