Header And Logo

PostgreSQL
| The world's most advanced open source database.

predicate.h

Go to the documentation of this file.
00001 /*-------------------------------------------------------------------------
00002  *
00003  * predicate.h
00004  *    POSTGRES public predicate locking definitions.
00005  *
00006  *
00007  * Portions Copyright (c) 1996-2013, PostgreSQL Global Development Group
00008  * Portions Copyright (c) 1994, Regents of the University of California
00009  *
00010  * src/include/storage/predicate.h
00011  *
00012  *-------------------------------------------------------------------------
00013  */
00014 #ifndef PREDICATE_H
00015 #define PREDICATE_H
00016 
00017 #include "utils/relcache.h"
00018 #include "utils/snapshot.h"
00019 
00020 
00021 /*
00022  * GUC variables
00023  */
00024 extern int  max_predicate_locks_per_xact;
00025 
00026 
00027 /* Number of SLRU buffers to use for predicate locking */
00028 #define NUM_OLDSERXID_BUFFERS   16
00029 
00030 
00031 /*
00032  * function prototypes
00033  */
00034 
00035 /* housekeeping for shared memory predicate lock structures */
00036 extern void InitPredicateLocks(void);
00037 extern Size PredicateLockShmemSize(void);
00038 
00039 extern void CheckPointPredicate(void);
00040 
00041 /* predicate lock reporting */
00042 extern bool PageIsPredicateLocked(Relation relation, BlockNumber blkno);
00043 
00044 /* predicate lock maintenance */
00045 extern Snapshot GetSerializableTransactionSnapshot(Snapshot snapshot);
00046 extern void SetSerializableTransactionSnapshot(Snapshot snapshot,
00047                                    TransactionId sourcexid);
00048 extern void RegisterPredicateLockingXid(TransactionId xid);
00049 extern void PredicateLockRelation(Relation relation, Snapshot snapshot);
00050 extern void PredicateLockPage(Relation relation, BlockNumber blkno, Snapshot snapshot);
00051 extern void PredicateLockTuple(Relation relation, HeapTuple tuple, Snapshot snapshot);
00052 extern void PredicateLockPageSplit(Relation relation, BlockNumber oldblkno, BlockNumber newblkno);
00053 extern void PredicateLockPageCombine(Relation relation, BlockNumber oldblkno, BlockNumber newblkno);
00054 extern void TransferPredicateLocksToHeapRelation(Relation relation);
00055 extern void ReleasePredicateLocks(bool isCommit);
00056 
00057 /* conflict detection (may also trigger rollback) */
00058 extern void CheckForSerializableConflictOut(bool valid, Relation relation, HeapTuple tuple,
00059                                 Buffer buffer, Snapshot snapshot);
00060 extern void CheckForSerializableConflictIn(Relation relation, HeapTuple tuple, Buffer buffer);
00061 extern void CheckTableForSerializableConflictIn(Relation relation);
00062 
00063 /* final rollback checking */
00064 extern void PreCommit_CheckForSerializationFailure(void);
00065 
00066 /* two-phase commit support */
00067 extern void AtPrepare_PredicateLocks(void);
00068 extern void PostPrepare_PredicateLocks(TransactionId xid);
00069 extern void PredicateLockTwoPhaseFinish(TransactionId xid, bool isCommit);
00070 extern void predicatelock_twophase_recover(TransactionId xid, uint16 info,
00071                                void *recdata, uint32 len);
00072 
00073 #endif   /* PREDICATE_H */