mirror of
https://github.com/postgres/postgres.git
synced 2026-02-10 22:33:50 -05:00
Originally, the names assigned to SLRUs had no purpose other than being shmem lookup keys, so not a lot of thought went into them. As of v13, though, we're exposing them in the pg_stat_slru view and the pg_stat_reset_slru function, so it seems advisable to take a bit more care. Rename them to names based on the associated on-disk storage directories (which fortunately we *did* think about, to some extent; since those are also visible to DBAs, consistency seems like a good thing). Also rename the associated LWLocks, since those names are likewise user-exposed now as wait event names. For the most part I only touched symbols used in the respective modules' SimpleLruInit() calls, not the names of other related objects. This renaming could have been taken further, and maybe someday we will do so. But for now it seems undesirable to change the names of any globally visible functions or structs, so some inconsistency is unavoidable. (But I *did* terminate "oldserxid" with prejudice, as I found that name both unreadable and not descriptive of the SLRU's contents.) Table 27.12 needs re-alphabetization now, but I'll leave that till after the other LWLock renamings I have in mind. Discussion: https://postgr.es/m/28683.1589405363@sss.pgh.pa.us
87 lines
3.1 KiB
C
87 lines
3.1 KiB
C
/*-------------------------------------------------------------------------
|
|
*
|
|
* predicate.h
|
|
* POSTGRES public predicate locking definitions.
|
|
*
|
|
*
|
|
* Portions Copyright (c) 1996-2020, PostgreSQL Global Development Group
|
|
* Portions Copyright (c) 1994, Regents of the University of California
|
|
*
|
|
* src/include/storage/predicate.h
|
|
*
|
|
*-------------------------------------------------------------------------
|
|
*/
|
|
#ifndef PREDICATE_H
|
|
#define PREDICATE_H
|
|
|
|
#include "storage/lock.h"
|
|
#include "utils/relcache.h"
|
|
#include "utils/snapshot.h"
|
|
|
|
|
|
/*
|
|
* GUC variables
|
|
*/
|
|
extern int max_predicate_locks_per_xact;
|
|
extern int max_predicate_locks_per_relation;
|
|
extern int max_predicate_locks_per_page;
|
|
|
|
|
|
/* Number of SLRU buffers to use for Serial SLRU */
|
|
#define NUM_SERIAL_BUFFERS 16
|
|
|
|
/*
|
|
* A handle used for sharing SERIALIZABLEXACT objects between the participants
|
|
* in a parallel query.
|
|
*/
|
|
typedef void *SerializableXactHandle;
|
|
|
|
/*
|
|
* function prototypes
|
|
*/
|
|
|
|
/* housekeeping for shared memory predicate lock structures */
|
|
extern void InitPredicateLocks(void);
|
|
extern Size PredicateLockShmemSize(void);
|
|
|
|
extern void CheckPointPredicate(void);
|
|
|
|
/* predicate lock reporting */
|
|
extern bool PageIsPredicateLocked(Relation relation, BlockNumber blkno);
|
|
|
|
/* predicate lock maintenance */
|
|
extern Snapshot GetSerializableTransactionSnapshot(Snapshot snapshot);
|
|
extern void SetSerializableTransactionSnapshot(Snapshot snapshot,
|
|
VirtualTransactionId *sourcevxid,
|
|
int sourcepid);
|
|
extern void RegisterPredicateLockingXid(TransactionId xid);
|
|
extern void PredicateLockRelation(Relation relation, Snapshot snapshot);
|
|
extern void PredicateLockPage(Relation relation, BlockNumber blkno, Snapshot snapshot);
|
|
extern void PredicateLockTID(Relation relation, ItemPointer tid, Snapshot snapshot,
|
|
TransactionId insert_xid);
|
|
extern void PredicateLockPageSplit(Relation relation, BlockNumber oldblkno, BlockNumber newblkno);
|
|
extern void PredicateLockPageCombine(Relation relation, BlockNumber oldblkno, BlockNumber newblkno);
|
|
extern void TransferPredicateLocksToHeapRelation(Relation relation);
|
|
extern void ReleasePredicateLocks(bool isCommit, bool isReadOnlySafe);
|
|
|
|
/* conflict detection (may also trigger rollback) */
|
|
extern bool CheckForSerializableConflictOutNeeded(Relation relation, Snapshot snapshot);
|
|
extern void CheckForSerializableConflictOut(Relation relation, TransactionId xid, Snapshot snapshot);
|
|
extern void CheckForSerializableConflictIn(Relation relation, ItemPointer tid, BlockNumber blkno);
|
|
extern void CheckTableForSerializableConflictIn(Relation relation);
|
|
|
|
/* final rollback checking */
|
|
extern void PreCommit_CheckForSerializationFailure(void);
|
|
|
|
/* two-phase commit support */
|
|
extern void AtPrepare_PredicateLocks(void);
|
|
extern void PostPrepare_PredicateLocks(TransactionId xid);
|
|
extern void PredicateLockTwoPhaseFinish(TransactionId xid, bool isCommit);
|
|
extern void predicatelock_twophase_recover(TransactionId xid, uint16 info,
|
|
void *recdata, uint32 len);
|
|
|
|
/* parallel query support */
|
|
extern SerializableXactHandle ShareSerializableXact(void);
|
|
extern void AttachSerializableXact(SerializableXactHandle handle);
|
|
|
|
#endif /* PREDICATE_H */
|