PostgreSQL Source Code  git master
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:1929
void CheckForSerializableConflictIn(Relation relation, HeapTuple tuple, Buffer buffer)
Definition: predicate.c:4326
uint32 TransactionId
Definition: c.h:455
void CheckForSerializableConflictOut(bool valid, Relation relation, HeapTuple tuple, Buffer buffer, Snapshot snapshot)
Definition: predicate.c:3945
void RegisterPredicateLockingXid(TransactionId xid)
Definition: predicate.c:1880
uint32 BlockNumber
Definition: block.h:31
void PredicateLockPage(Relation relation, BlockNumber blkno, Snapshot snapshot)
Definition: predicate.c:2521
void CheckPointPredicate(void)
Definition: predicate.c:1043
Snapshot GetSerializableTransactionSnapshot(Snapshot snapshot)
Definition: predicate.c:1636
void CheckTableForSerializableConflictIn(Relation relation)
Definition: predicate.c:4410
unsigned short uint16
Definition: c.h:305
void PredicateLockTuple(Relation relation, HeapTuple tuple, Snapshot snapshot)
Definition: predicate.c:2543
Size PredicateLockShmemSize(void)
Definition: predicate.c:1311
void ReleasePredicateLocks(bool isCommit)
Definition: predicate.c:3268
unsigned int uint32
Definition: c.h:306
int max_predicate_locks_per_xact
Definition: predicate.c:363
void PredicateLockPageSplit(Relation relation, BlockNumber oldblkno, BlockNumber newblkno)
Definition: predicate.c:3111
int max_predicate_locks_per_relation
Definition: predicate.c:364
void PostPrepare_PredicateLocks(TransactionId xid)
Definition: predicate.c:4874
int max_predicate_locks_per_page
Definition: predicate.c:365
void PredicateLockPageCombine(Relation relation, BlockNumber oldblkno, BlockNumber newblkno)
Definition: predicate.c:3196
void SetSerializableTransactionSnapshot(Snapshot snapshot, VirtualTransactionId *sourcevxid, int sourcepid)
Definition: predicate.c:1676
void InitPredicateLocks(void)
Definition: predicate.c:1108
void PredicateLockTwoPhaseFinish(TransactionId xid, bool isCommit)
Definition: predicate.c:4896
WalTimeSample buffer[LAG_TRACKER_BUFFER_SIZE]
Definition: walsender.c:214
void PreCommit_CheckForSerializationFailure(void)
Definition: predicate.c:4712
size_t Size
Definition: c.h:414
void TransferPredicateLocksToHeapRelation(Relation relation)
Definition: predicate.c:3090
void predicatelock_twophase_recover(TransactionId xid, uint16 info, void *recdata, uint32 len)
Definition: predicate.c:4923
void PredicateLockRelation(Relation relation, Snapshot snapshot)
Definition: predicate.c:2498
int Buffer
Definition: buf.h:23
void AtPrepare_PredicateLocks(void)
Definition: predicate.c:4805