PostgreSQL Source Code
git master
|
#include "postgres.h"
#include "access/parallel.h"
#include "access/slru.h"
#include "access/subtrans.h"
#include "access/transam.h"
#include "access/twophase.h"
#include "access/twophase_rmgr.h"
#include "access/xact.h"
#include "access/xlog.h"
#include "miscadmin.h"
#include "pgstat.h"
#include "storage/bufmgr.h"
#include "storage/predicate.h"
#include "storage/predicate_internals.h"
#include "storage/proc.h"
#include "storage/procarray.h"
#include "utils/rel.h"
#include "utils/snapmgr.h"
Go to the source code of this file.
Data Structures | |
struct | SerialControlData |
Typedefs | |
typedef struct SerialControlData | SerialControlData |
typedef struct SerialControlData * | SerialControl |
Variables | |
static SlruCtlData | SerialSlruCtlData |
static SerialControl | serialControl |
static SERIALIZABLEXACT * | OldCommittedSxact |
int | max_predicate_locks_per_xact |
int | max_predicate_locks_per_relation |
int | max_predicate_locks_per_page |
static PredXactList | PredXact |
static RWConflictPoolHeader | RWConflictPool |
static HTAB * | SerializableXidHash |
static HTAB * | PredicateLockTargetHash |
static HTAB * | PredicateLockHash |
static SHM_QUEUE * | FinishedSerializableTransactions |
static const PREDICATELOCKTARGETTAG | ScratchTargetTag = {0, 0, 0, 0} |
static uint32 | ScratchTargetTagHash |
static LWLock * | ScratchPartitionLock |
static HTAB * | LocalPredicateLockHash = NULL |
static SERIALIZABLEXACT * | MySerializableXact = InvalidSerializableXact |
static bool | MyXactDidWrite = false |
static SERIALIZABLEXACT * | SavedSerializableXact = InvalidSerializableXact |
#define NPREDICATELOCKTARGETENTS | ( | ) | mul_size(max_predicate_locks_per_xact, add_size(MaxBackends, max_prepared_xacts)) |
Definition at line 259 of file predicate.c.
Referenced by InitPredicateLocks(), and PredicateLockShmemSize().
#define PredicateLockHashCodeFromTargetHashCode | ( | predicatelocktag, | |
targethash | |||
) |
Definition at line 311 of file predicate.c.
Referenced by CheckTargetForConflictsIn(), ClearOldPredicateLocks(), CreatePredicateLock(), DeleteChildTargetLocks(), DeleteLockTarget(), DropAllPredicateLocksFromTable(), predicatelock_hash(), ReleaseOneSerializableXact(), and TransferPredicateLocksToNewTarget().
#define PredicateLockHashPartition | ( | hashcode | ) | ((hashcode) % NUM_PREDICATELOCK_PARTITIONS) |
Definition at line 251 of file predicate.c.
#define PredicateLockHashPartitionLock | ( | hashcode | ) |
Definition at line 253 of file predicate.c.
Referenced by CheckTargetForConflictsIn(), ClearOldPredicateLocks(), CreatePredicateLock(), DeleteChildTargetLocks(), DeleteLockTarget(), InitPredicateLocks(), PageIsPredicateLocked(), ReleaseOneSerializableXact(), and TransferPredicateLocksToNewTarget().
#define PredicateLockHashPartitionLockByIndex | ( | i | ) | (&MainLWLockArray[PREDICATELOCK_MANAGER_LWLOCK_OFFSET + (i)].lock) |
Definition at line 256 of file predicate.c.
Referenced by CheckTableForSerializableConflictIn(), DropAllPredicateLocksFromTable(), and GetPredicateLockStatusData().
#define PredicateLockTargetTagHashCode | ( | predicatelocktargettag | ) | get_hash_value(PredicateLockTargetHash, predicatelocktargettag) |
Definition at line 298 of file predicate.c.
Referenced by CheckTargetForConflictsIn(), ClearOldPredicateLocks(), DecrementParentLocks(), DeleteChildTargetLocks(), DropAllPredicateLocksFromTable(), InitPredicateLocks(), PageIsPredicateLocked(), predicatelock_hash(), predicatelock_twophase_recover(), PredicateLockAcquire(), ReleaseOneSerializableXact(), and TransferPredicateLocksToNewTarget().
#define SERIAL_ENTRIESPERPAGE (SERIAL_PAGESIZE / SERIAL_ENTRYSIZE) |
Definition at line 325 of file predicate.c.
Referenced by SerialInit(), and SerialPagePrecedesLogically().
#define SERIAL_ENTRYSIZE sizeof(SerCommitSeqNo) |
Definition at line 324 of file predicate.c.
#define SERIAL_MAX_PAGE (MaxTransactionId / SERIAL_ENTRIESPERPAGE) |
Definition at line 330 of file predicate.c.
#define SERIAL_PAGESIZE BLCKSZ |
Definition at line 323 of file predicate.c.
#define SerialNextPage | ( | page | ) | (((page) >= SERIAL_MAX_PAGE) ? 0 : (page) + 1) |
Definition at line 332 of file predicate.c.
Referenced by SerialAdd().
#define SerialPage | ( | xid | ) | (((uint32) (xid)) / SERIAL_ENTRIESPERPAGE) |
Definition at line 338 of file predicate.c.
Referenced by CheckPointPredicate(), SerialAdd(), and SerialGetMinConflictCommitSeqNo().
#define SerialSlruCtl (&SerialSlruCtlData) |
Definition at line 321 of file predicate.c.
Referenced by CheckPointPredicate(), SerialAdd(), SerialGetMinConflictCommitSeqNo(), and SerialInit().
#define SerialValue | ( | slotno, | |
xid | |||
) |
Definition at line 334 of file predicate.c.
Referenced by SerialAdd(), and SerialGetMinConflictCommitSeqNo().
#define SxactHasConflictOut | ( | sxact | ) | (((sxact)->flags & SXACT_FLAG_CONFLICT_OUT) != 0) |
Definition at line 284 of file predicate.c.
Referenced by CheckForSerializableConflictOut(), OnConflict_CheckForSerializationFailure(), ReleasePredicateLocks(), and SummarizeOldestCommittedSxact().
#define SxactHasSummaryConflictIn | ( | sxact | ) | (((sxact)->flags & SXACT_FLAG_SUMMARY_CONFLICT_IN) != 0) |
Definition at line 277 of file predicate.c.
Referenced by CheckForSerializableConflictOut(), and OnConflict_CheckForSerializationFailure().
#define SxactHasSummaryConflictOut | ( | sxact | ) | (((sxact)->flags & SXACT_FLAG_SUMMARY_CONFLICT_OUT) != 0) |
Definition at line 278 of file predicate.c.
Referenced by CheckForSerializableConflictOut(), OnConflict_CheckForSerializationFailure(), and ReleasePredicateLocks().
#define SxactIsCommitted | ( | sxact | ) | (((sxact)->flags & SXACT_FLAG_COMMITTED) != 0) |
Definition at line 272 of file predicate.c.
Referenced by CheckForSerializableConflictOut(), CheckTargetForConflictsIn(), GetSerializableTransactionSnapshotInt(), OnConflict_CheckForSerializationFailure(), PreCommit_CheckForSerializationFailure(), ReleaseOneSerializableXact(), ReleasePredicateLocks(), and SetNewSxactGlobalXmin().
#define SxactIsDeferrableWaiting | ( | sxact | ) | (((sxact)->flags & SXACT_FLAG_DEFERRABLE_WAITING) != 0) |
Definition at line 285 of file predicate.c.
Referenced by GetSafeSnapshotBlockingPids(), and ReleasePredicateLocks().
#define SxactIsDoomed | ( | sxact | ) | (((sxact)->flags & SXACT_FLAG_DOOMED) != 0) |
Definition at line 275 of file predicate.c.
Referenced by CheckForSerializableConflictIn(), CheckForSerializableConflictOut(), CheckForSerializableConflictOutNeeded(), CheckTargetForConflictsIn(), GetSerializableTransactionSnapshotInt(), OnConflict_CheckForSerializationFailure(), PreCommit_CheckForSerializationFailure(), ReleasePredicateLocks(), and RWConflictExists().
#define SxactIsOnFinishedList | ( | sxact | ) | (!SHMQueueIsDetached(&((sxact)->finishedLink))) |
Definition at line 262 of file predicate.c.
Referenced by ReleaseOneSerializableXact(), and ReleasePredicateLocks().
#define SxactIsPartiallyReleased | ( | sxact | ) | (((sxact)->flags & SXACT_FLAG_PARTIALLY_RELEASED) != 0) |
Definition at line 288 of file predicate.c.
Referenced by PreCommit_CheckForSerializationFailure(), and ReleasePredicateLocks().
#define SxactIsPrepared | ( | sxact | ) | (((sxact)->flags & SXACT_FLAG_PREPARED) != 0) |
Definition at line 273 of file predicate.c.
Referenced by CheckForSerializableConflictOut(), OnConflict_CheckForSerializationFailure(), PostPrepare_PredicateLocks(), PreCommit_CheckForSerializationFailure(), predicatelock_twophase_recover(), and ReleasePredicateLocks().
#define SxactIsReadOnly | ( | sxact | ) | (((sxact)->flags & SXACT_FLAG_READ_ONLY) != 0) |
Definition at line 276 of file predicate.c.
Referenced by CheckForSerializableConflictOut(), ClearOldPredicateLocks(), FlagSxactUnsafe(), GetSerializableTransactionSnapshotInt(), OnConflict_CheckForSerializationFailure(), PreCommit_CheckForSerializationFailure(), predicatelock_twophase_recover(), ReleasePredicateLocks(), SetPossibleUnsafeConflict(), and SummarizeOldestCommittedSxact().
#define SxactIsRolledBack | ( | sxact | ) | (((sxact)->flags & SXACT_FLAG_ROLLED_BACK) != 0) |
Definition at line 274 of file predicate.c.
Referenced by ReleaseOneSerializableXact(), ReleasePredicateLocks(), and SetNewSxactGlobalXmin().
#define SxactIsROSafe | ( | sxact | ) | (((sxact)->flags & SXACT_FLAG_RO_SAFE) != 0) |
Definition at line 286 of file predicate.c.
Referenced by FlagSxactUnsafe(), GetSafeSnapshot(), ReleasePredicateLocks(), and SerializationNeededForRead().
#define SxactIsROUnsafe | ( | sxact | ) | (((sxact)->flags & SXACT_FLAG_RO_UNSAFE) != 0) |
Definition at line 287 of file predicate.c.
Referenced by GetSafeSnapshot(), and ReleasePredicateLocks().
#define TargetTagIsCoveredBy | ( | covered_target, | |
covering_target | |||
) |
Definition at line 228 of file predicate.c.
Referenced by DeleteChildTargetLocks().
typedef struct SerialControlData* SerialControl |
Definition at line 347 of file predicate.c.
typedef struct SerialControlData SerialControlData |
void AtPrepare_PredicateLocks | ( | void | ) |
Definition at line 4925 of file predicate.c.
References Assert, TwoPhasePredicateRecord::data, SERIALIZABLEXACT::flags, TwoPhasePredicateXactRecord::flags, InvalidSerializableXact, IsParallelWorker, TwoPhasePredicateRecord::lockRecord, LW_SHARED, LWLockAcquire(), LWLockRelease(), MySerializableXact, PREDICATELOCKTAG::myTarget, offsetof, ParallelContextActive(), SERIALIZABLEXACT::predicateLocks, RegisterTwoPhaseRecord(), SHMQueueNext(), PREDICATELOCKTARGET::tag, PREDICATELOCK::tag, TwoPhasePredicateLockRecord::target, TWOPHASE_RM_PREDICATELOCK_ID, TWOPHASEPREDICATERECORD_LOCK, TWOPHASEPREDICATERECORD_XACT, TwoPhasePredicateRecord::type, PREDICATELOCK::xactLink, TwoPhasePredicateRecord::xactRecord, SERIALIZABLEXACT::xmin, and TwoPhasePredicateXactRecord::xmin.
Referenced by PrepareTransaction().
void AttachSerializableXact | ( | SerializableXactHandle | handle | ) |
Definition at line 5195 of file predicate.c.
References Assert, CreateLocalPredicateLockHash(), and InvalidSerializableXact.
Referenced by ParallelWorkerMain().
|
static |
Definition at line 2318 of file predicate.c.
References LOCALPREDICATELOCK::childLocks, GetParentPredicateLockTag(), HASH_ENTER, hash_search(), LOCALPREDICATELOCK::held, MaxPredicateChildLocks(), and PredicateLockAcquire().
Referenced by PredicateLockAcquire().
void CheckForSerializableConflictIn | ( | Relation | relation, |
ItemPointer | tid, | ||
BlockNumber | blkno | ||
) |
Definition at line 4446 of file predicate.c.
References CheckTargetForConflictsIn(), RelFileNode::dbNode, ereport, errcode(), errdetail_internal(), errhint(), errmsg(), ERROR, InvalidBlockNumber, ItemPointerGetBlockNumber, ItemPointerGetOffsetNumber, MyXactDidWrite, RelationData::rd_id, RelationData::rd_node, SerializationNeededForWrite(), SET_PREDICATELOCKTARGETTAG_PAGE, SET_PREDICATELOCKTARGETTAG_RELATION, SET_PREDICATELOCKTARGETTAG_TUPLE, and SxactIsDoomed.
Referenced by _bt_check_unique(), _bt_doinsert(), _hash_doinsert(), ginEntryInsert(), ginFindLeafPage(), ginHeapTupleFastInsert(), gistinserttuples(), heap_delete(), heap_insert(), heap_multi_insert(), heap_update(), and index_insert().
void CheckForSerializableConflictOut | ( | Relation | relation, |
TransactionId | xid, | ||
Snapshot | snapshot | ||
) |
Definition at line 4121 of file predicate.c.
References Assert, SERIALIZABLEXACT::earliestOutConflictCommit, ereport, errcode(), errdetail_internal(), errhint(), errmsg(), ERROR, FlagRWConflict(), SERIALIZABLEXACT::flags, GetTopTransactionIdIfAny(), HASH_FIND, hash_search(), SERIALIZABLEXACT::inConflicts, InvalidSerCommitSeqNo, SERIALIZABLEXACT::lastCommitBeforeSnapshot, LW_EXCLUSIVE, LWLockAcquire(), LWLockRelease(), SERIALIZABLEXID::myXact, RWConflictExists(), SERIALIZABLEXACT::SeqNo, SerialGetMinConflictCommitSeqNo(), SerializationNeededForRead(), SHMQueueEmpty(), SXACT_FLAG_DOOMED, SXACT_FLAG_SUMMARY_CONFLICT_OUT, SxactHasConflictOut, SxactHasSummaryConflictIn, SxactHasSummaryConflictOut, SxactIsCommitted, SxactIsDoomed, SxactIsPrepared, SxactIsReadOnly, SERIALIZABLEXACT::topXid, TransactionIdEquals, TransactionIdIsValid, SERIALIZABLEXIDTAG::xid, and XidIsConcurrent().
Referenced by HeapCheckForSerializableConflictOut().
Definition at line 4089 of file predicate.c.
References ereport, errcode(), errdetail_internal(), errhint(), errmsg(), ERROR, SerializationNeededForRead(), and SxactIsDoomed.
Referenced by HeapCheckForSerializableConflictOut().
void CheckPointPredicate | ( | void | ) |
Definition at line 1069 of file predicate.c.
References SerialControlData::headPage, LW_EXCLUSIVE, LWLockAcquire(), LWLockRelease(), SerialPage, SerialSlruCtl, SimpleLruTruncate(), SimpleLruWriteAll(), SerialControlData::tailXid, and TransactionIdIsValid.
Referenced by CheckPointGuts().
void CheckTableForSerializableConflictIn | ( | Relation | relation | ) |
Definition at line 4529 of file predicate.c.
References Assert, RelFileNode::dbNode, FlagRWConflict(), GET_PREDICATELOCKTARGETTAG_DB, GET_PREDICATELOCKTARGETTAG_RELATION, hash_seq_init(), hash_seq_search(), i, LW_EXCLUSIVE, LW_SHARED, LWLockAcquire(), LWLockRelease(), PREDICATELOCKTAG::myXact, MyXactDidWrite, NUM_PREDICATELOCK_PARTITIONS, offsetof, PredicateLockHashPartitionLockByIndex, PREDICATELOCKTARGET::predicateLocks, RelationData::rd_id, RelationData::rd_index, RelationData::rd_node, RWConflictExists(), SerializationNeededForWrite(), SHMQueueNext(), PredXactListData::SxactGlobalXmin, PREDICATELOCKTARGET::tag, PREDICATELOCK::tag, PREDICATELOCK::targetLink, and TransactionIdIsValid.
Referenced by ExecuteTruncateGuts(), and heap_drop_with_catalog().
|
static |
Definition at line 4264 of file predicate.c.
References Assert, DecrementParentLocks(), SERIALIZABLEXACT::finishedBefore, FlagRWConflict(), GET_PREDICATELOCKTARGETTAG_OFFSET, GetTransactionSnapshot(), HASH_FIND, HASH_REMOVE, hash_search_with_hash_value(), InvalidSerializableXact, IsInParallelMode(), IsSubTransaction(), LW_EXCLUSIVE, LW_SHARED, LWLockAcquire(), LWLockRelease(), PREDICATELOCKTAG::myXact, offsetof, SERIALIZABLEXACT::perXactPredicateListLock, PredicateLockHashCodeFromTargetHashCode, PredicateLockHashPartitionLock, PREDICATELOCKTARGET::predicateLocks, PredicateLockTargetTagHashCode, RemoveTargetIfNoLongerUsed(), RWConflictExists(), SHMQueueDelete(), SHMQueueNext(), SxactIsCommitted, SxactIsDoomed, PREDICATELOCK::tag, PREDICATELOCK::targetLink, TransactionIdPrecedes(), and PREDICATELOCK::xactLink.
Referenced by CheckForSerializableConflictIn().
|
static |
Definition at line 3743 of file predicate.c.
References Assert, PredXactListData::CanPartialClearThrough, SERIALIZABLEXACT::commitSeqNo, PREDICATELOCK::commitSeqNo, SERIALIZABLEXACT::finishedBefore, SERIALIZABLEXACT::finishedLink, HASH_REMOVE, hash_search_with_hash_value(), PredXactListData::HavePartialClearedThrough, InvalidSerCommitSeqNo, LW_EXCLUSIVE, LW_SHARED, LWLockAcquire(), LWLockRelease(), PREDICATELOCKTAG::myTarget, offsetof, PredicateLockHashCodeFromTargetHashCode, PredicateLockHashPartitionLock, SERIALIZABLEXACT::predicateLocks, PredicateLockTargetTagHashCode, ReleaseOneSerializableXact(), RemoveTargetIfNoLongerUsed(), SHMQueueDelete(), SHMQueueNext(), PredXactListData::SxactGlobalXmin, SxactIsReadOnly, PREDICATELOCKTARGET::tag, PREDICATELOCK::tag, PREDICATELOCK::targetLink, TransactionIdIsValid, TransactionIdPrecedesOrEquals(), and PREDICATELOCK::xactLink.
Referenced by ReleasePredicateLocks().
|
static |
Definition at line 2093 of file predicate.c.
References GetParentPredicateLockTag(), and PredicateLockExists().
Referenced by PredicateLockAcquire().
|
static |
Definition at line 1922 of file predicate.c.
References Assert, HASHCTL::entrysize, HASH_BLOBS, hash_create(), HASH_ELEM, HASHCTL::keysize, and max_predicate_locks_per_xact.
Referenced by AttachSerializableXact(), and GetSerializableTransactionSnapshotInt().
|
static |
Definition at line 2445 of file predicate.c.
References PREDICATELOCK::commitSeqNo, ereport, errcode(), errhint(), errmsg(), ERROR, HASH_ENTER_NULL, hash_search_with_hash_value(), InvalidSerCommitSeqNo, IsInParallelMode(), LW_EXCLUSIVE, LW_SHARED, LWLockAcquire(), LWLockRelease(), PREDICATELOCKTAG::myTarget, PREDICATELOCKTAG::myXact, SERIALIZABLEXACT::perXactPredicateListLock, PredicateLockHashCodeFromTargetHashCode, PredicateLockHashPartitionLock, SERIALIZABLEXACT::predicateLocks, PREDICATELOCKTARGET::predicateLocks, SHMQueueInit(), SHMQueueInsertBefore(), PREDICATELOCK::targetLink, and PREDICATELOCK::xactLink.
Referenced by predicatelock_twophase_recover(), and PredicateLockAcquire().
|
static |
Definition at line 580 of file predicate.c.
References PredXactListData::activeList, PredXactListData::availableList, PredXactListElementData::link, offsetof, SHMQueueDelete(), SHMQueueInsertBefore(), SHMQueueNext(), and PredXactListElementData::sxact.
Referenced by GetSerializableTransactionSnapshotInt(), InitPredicateLocks(), and predicatelock_twophase_recover().
|
static |
Definition at line 2383 of file predicate.c.
References Assert, LOCALPREDICATELOCK::childLocks, GetParentPredicateLockTag(), HASH_FIND, HASH_REMOVE, hash_search_with_hash_value(), LOCALPREDICATELOCK::held, PG_USED_FOR_ASSERTS_ONLY, and PredicateLockTargetTagHashCode.
Referenced by CheckTargetForConflictsIn(), and DeleteChildTargetLocks().
|
static |
Definition at line 2196 of file predicate.c.
References Assert, DecrementParentLocks(), HASH_REMOVE, hash_search_with_hash_value(), IsInParallelMode(), LW_EXCLUSIVE, LW_SHARED, LWLockAcquire(), LWLockRelease(), MySerializableXact, PREDICATELOCKTAG::myTarget, PREDICATELOCKTAG::myXact, offsetof, SERIALIZABLEXACT::perXactPredicateListLock, PG_USED_FOR_ASSERTS_ONLY, PredicateLockHashCodeFromTargetHashCode, PredicateLockHashPartitionLock, SERIALIZABLEXACT::predicateLocks, PredicateLockTargetTagHashCode, RemoveTargetIfNoLongerUsed(), SHMQueueDelete(), SHMQueueNext(), PREDICATELOCKTARGET::tag, PREDICATELOCK::tag, PREDICATELOCK::targetLink, TargetTagIsCoveredBy, and PREDICATELOCK::xactLink.
Referenced by PredicateLockAcquire().
|
static |
Definition at line 2662 of file predicate.c.
References Assert, HASH_REMOVE, hash_search_with_hash_value(), LW_EXCLUSIVE, LWLockAcquire(), LWLockHeldByMe(), LWLockHeldByMeInMode(), LWLockRelease(), offsetof, PredicateLockHashCodeFromTargetHashCode, PredicateLockHashPartitionLock, PREDICATELOCKTARGET::predicateLocks, RemoveTargetIfNoLongerUsed(), SHMQueueDelete(), SHMQueueNext(), PREDICATELOCK::tag, PREDICATELOCK::targetLink, and PREDICATELOCK::xactLink.
Referenced by TransferPredicateLocksToNewTarget().
Definition at line 2950 of file predicate.c.
References Assert, PREDICATELOCK::commitSeqNo, RelFileNode::dbNode, GET_PREDICATELOCKTARGETTAG_DB, GET_PREDICATELOCKTARGETTAG_RELATION, GET_PREDICATELOCKTARGETTAG_TYPE, HASH_ENTER, HASH_REMOVE, hash_search(), hash_search_with_hash_value(), hash_seq_init(), hash_seq_search(), i, InvalidOid, InvalidSerCommitSeqNo, LW_EXCLUSIVE, LWLockAcquire(), LWLockRelease(), PREDICATELOCKTAG::myTarget, PREDICATELOCKTAG::myXact, NUM_PREDICATELOCK_PARTITIONS, offsetof, PredicateLockHashCodeFromTargetHashCode, PredicateLockHashPartitionLockByIndex, PredicateLockingNeededForRelation(), SERIALIZABLEXACT::predicateLocks, PREDICATELOCKTARGET::predicateLocks, PredicateLockTargetTagHashCode, PREDLOCKTAG_RELATION, RelationData::rd_id, RelationData::rd_index, RelationData::rd_node, RemoveScratchTarget(), RestoreScratchTarget(), SET_PREDICATELOCKTARGETTAG_RELATION, SHMQueueDelete(), SHMQueueInit(), SHMQueueInsertBefore(), SHMQueueNext(), PredXactListData::SxactGlobalXmin, PREDICATELOCKTARGET::tag, PREDICATELOCK::tag, PREDICATELOCK::targetLink, TransactionIdIsValid, and PREDICATELOCK::xactLink.
Referenced by TransferPredicateLocksToHeapRelation().
|
static |
Definition at line 612 of file predicate.c.
References PredXactListData::activeList, offsetof, SHMQueueNext(), and PredXactListElementData::sxact.
Referenced by GetSafeSnapshotBlockingPids(), GetSerializableTransactionSnapshotInt(), and SetNewSxactGlobalXmin().
|
static |
Definition at line 4621 of file predicate.c.
References Assert, SERIALIZABLEXACT::flags, OnConflict_CheckForSerializationFailure(), SetRWConflict(), SXACT_FLAG_SUMMARY_CONFLICT_IN, and SXACT_FLAG_SUMMARY_CONFLICT_OUT.
Referenced by CheckForSerializableConflictOut(), CheckTableForSerializableConflictIn(), and CheckTargetForConflictsIn().
|
static |
Definition at line 750 of file predicate.c.
References Assert, SERIALIZABLEXACT::flags, RWConflictData::inLink, offsetof, SERIALIZABLEXACT::possibleUnsafeConflicts, ReleaseRWConflict(), SHMQueueNext(), SXACT_FLAG_RO_UNSAFE, RWConflictData::sxactIn, SxactIsReadOnly, SxactIsROSafe, and RWConflictData::sxactOut.
Referenced by ReleasePredicateLocks().
|
static |
Definition at line 2054 of file predicate.c.
References Assert, GET_PREDICATELOCKTARGETTAG_DB, GET_PREDICATELOCKTARGETTAG_PAGE, GET_PREDICATELOCKTARGETTAG_RELATION, GET_PREDICATELOCKTARGETTAG_TYPE, PREDLOCKTAG_PAGE, PREDLOCKTAG_RELATION, PREDLOCKTAG_TUPLE, SET_PREDICATELOCKTARGETTAG_PAGE, and SET_PREDICATELOCKTARGETTAG_RELATION.
Referenced by CheckAndPromotePredicateLockRequest(), CoarserLockCovers(), DecrementParentLocks(), and PredicateLockPageSplit().
PredicateLockData* GetPredicateLockStatusData | ( | void | ) |
Definition at line 1443 of file predicate.c.
References Assert, hash_get_num_entries(), hash_seq_init(), hash_seq_search(), i, PredicateLockData::locktags, LW_SHARED, LWLockAcquire(), LWLockRelease(), PREDICATELOCKTAG::myTarget, PREDICATELOCKTAG::myXact, PredicateLockData::nelements, NUM_PREDICATELOCK_PARTITIONS, palloc(), PredicateLockHashPartitionLockByIndex, PREDICATELOCKTARGET::tag, PREDICATELOCK::tag, and PredicateLockData::xacts.
Referenced by pg_lock_status().
Definition at line 1558 of file predicate.c.
References Assert, DEBUG2, ereport, errcode(), errmsg_internal(), SERIALIZABLEXACT::flags, GetSerializableTransactionSnapshotInt(), InvalidPid, InvalidSerializableXact, LW_EXCLUSIVE, LWLockAcquire(), LWLockRelease(), SERIALIZABLEXACT::possibleUnsafeConflicts, ProcWaitForSignal(), ReleasePredicateLocks(), SHMQueueEmpty(), SXACT_FLAG_DEFERRABLE_WAITING, SxactIsROSafe, SxactIsROUnsafe, WAIT_EVENT_SAFE_SNAPSHOT, XactDeferrable, and XactReadOnly.
Referenced by GetSerializableTransactionSnapshot().
int GetSafeSnapshotBlockingPids | ( | int | blocked_pid, |
int * | output, | ||
int | output_size | ||
) |
Definition at line 1628 of file predicate.c.
References FirstPredXact(), RWConflictData::inLink, LW_SHARED, LWLockAcquire(), LWLockRelease(), NextPredXact(), offsetof, SERIALIZABLEXACT::pid, SERIALIZABLEXACT::possibleUnsafeConflicts, SHMQueueNext(), SxactIsDeferrableWaiting, and RWConflictData::sxactOut.
Referenced by pg_isolation_test_session_is_blocked(), and pg_safe_snapshot_blocking_pids().
Definition at line 1680 of file predicate.c.
References Assert, ereport, errcode(), errdetail(), errhint(), errmsg(), ERROR, GetSafeSnapshot(), GetSerializableTransactionSnapshotInt(), InvalidPid, IsolationIsSerializable, RecoveryInProgress(), XactDeferrable, and XactReadOnly.
Referenced by GetTransactionSnapshot().
|
static |
Definition at line 1762 of file predicate.c.
References Assert, SERIALIZABLEXACT::commitSeqNo, CreateLocalPredicateLockHash(), CreatePredXact(), elog, ereport, errcode(), errdetail(), errmsg(), ERROR, SERIALIZABLEXACT::finishedBefore, SERIALIZABLEXACT::finishedLink, FirstPredXact(), SERIALIZABLEXACT::flags, GET_VXID_FROM_PGPROC, GetSnapshotData(), GetTopTransactionIdIfAny(), SERIALIZABLEXACT::inConflicts, InvalidSerCommitSeqNo, InvalidSerializableXact, InvalidTransactionId, IsInParallelMode(), SERIALIZABLEXACT::lastCommitBeforeSnapshot, PredXactListData::LastSxactCommitSeqNo, LW_EXCLUSIVE, LWLockAcquire(), LWLockRelease(), max_prepared_xacts, MaxBackends, MyProc, MyProcPid, MyXactDidWrite, NextPredXact(), SERIALIZABLEXACT::outConflicts, SERIALIZABLEXACT::pid, SERIALIZABLEXACT::possibleUnsafeConflicts, SERIALIZABLEXACT::predicateLocks, SERIALIZABLEXACT::prepareSeqNo, ProcArrayInstallImportedXmin(), RecoveryInProgress(), ReleasePredXact(), SERIALIZABLEXACT::SeqNo, SerialSetActiveSerXmin(), SetPossibleUnsafeConflict(), SHMQueueElemInit(), SHMQueueInit(), SummarizeOldestCommittedSxact(), SXACT_FLAG_READ_ONLY, PredXactListData::SxactGlobalXmin, PredXactListData::SxactGlobalXminCount, SxactIsCommitted, SxactIsDoomed, SxactIsReadOnly, SERIALIZABLEXACT::topXid, TransactionIdEquals, TransactionIdFollows(), TransactionIdIsValid, SERIALIZABLEXACT::vxid, PredXactListData::WritableSxactCount, XactReadOnly, SERIALIZABLEXACT::xmin, and SnapshotData::xmin.
Referenced by GetSafeSnapshot(), GetSerializableTransactionSnapshot(), and SetSerializableTransactionSnapshot().
void InitPredicateLocks | ( | void | ) |
Definition at line 1153 of file predicate.c.
References PredXactListData::activeList, Assert, PredXactListData::availableList, RWConflictPoolHeaderData::availableList, PredXactListData::CanPartialClearThrough, SERIALIZABLEXACT::commitSeqNo, CreatePredXact(), PredXactListData::element, RWConflictPoolHeaderData::element, HASHCTL::entrysize, SERIALIZABLEXACT::finishedBefore, SERIALIZABLEXACT::finishedLink, FirstNormalSerCommitSeqNo, SERIALIZABLEXACT::flags, HASHCTL::hash, HASH_BLOBS, HASH_ELEM, HASH_ENTER, HASH_FIXED_SIZE, HASH_FUNCTION, HASH_PARTITION, hash_search(), PredXactListData::HavePartialClearedThrough, i, SERIALIZABLEXACT::inConflicts, InvalidTransactionId, IsUnderPostmaster, HASHCTL::keysize, SERIALIZABLEXACT::lastCommitBeforeSnapshot, PredXactListData::LastSxactCommitSeqNo, PredXactListElementData::link, LWLockInitialize(), LWTRANCHE_PER_XACT_PREDICATE_LIST, max_prepared_xacts, MaxBackends, mul_size(), NPREDICATELOCKTARGETENTS, HASHCTL::num_partitions, NUM_PREDICATELOCK_PARTITIONS, PredXactListData::OldCommittedSxact, SERIALIZABLEXACT::outConflicts, RWConflictData::outLink, SERIALIZABLEXACT::perXactPredicateListLock, SERIALIZABLEXACT::pid, SERIALIZABLEXACT::possibleUnsafeConflicts, predicatelock_hash(), PredicateLockHashPartitionLock, SERIALIZABLEXACT::predicateLocks, PredicateLockTargetTagHashCode, PredXactListDataSize, PredXactListElementDataSize, SERIALIZABLEXACT::prepareSeqNo, RWConflictDataSize, RWConflictPoolHeaderDataSize, ScratchTargetTagHash, SERIALIZABLEXACT::SeqNo, SerialInit(), SetInvalidVirtualTransactionId, ShmemAlloc(), ShmemInitHash(), ShmemInitStruct(), SHMQueueInit(), SHMQueueInsertBefore(), PredXactListElementData::sxact, SXACT_FLAG_COMMITTED, PredXactListData::SxactGlobalXmin, PredXactListData::SxactGlobalXminCount, SERIALIZABLEXACT::topXid, SERIALIZABLEXACT::vxid, PredXactListData::WritableSxactCount, and SERIALIZABLEXACT::xmin.
Referenced by CreateSharedMemoryAndSemaphores().
|
static |
Definition at line 2281 of file predicate.c.
References Assert, GET_PREDICATELOCKTARGETTAG_TYPE, max_predicate_locks_per_page, max_predicate_locks_per_relation, max_predicate_locks_per_xact, PREDLOCKTAG_PAGE, PREDLOCKTAG_RELATION, and PREDLOCKTAG_TUPLE.
Referenced by CheckAndPromotePredicateLockRequest().
|
static |
Definition at line 627 of file predicate.c.
References PredXactListData::activeList, Assert, PredXactListElementData::link, offsetof, ShmemAddrIsValid(), SHMQueueNext(), and PredXactListElementData::sxact.
Referenced by GetSafeSnapshotBlockingPids(), GetSerializableTransactionSnapshotInt(), and SetNewSxactGlobalXmin().
|
static |
Definition at line 4656 of file predicate.c.
References Assert, SERIALIZABLEXACT::commitSeqNo, ereport, errcode(), errdetail_internal(), errhint(), errmsg(), ERROR, SERIALIZABLEXACT::flags, SERIALIZABLEXACT::inConflicts, RWConflictData::inLink, SERIALIZABLEXACT::lastCommitBeforeSnapshot, LWLockHeldByMe(), LWLockRelease(), offsetof, SERIALIZABLEXACT::outConflicts, RWConflictData::outLink, SERIALIZABLEXACT::prepareSeqNo, SERIALIZABLEXACT::SeqNo, SHMQueueNext(), SXACT_FLAG_DOOMED, SxactHasConflictOut, SxactHasSummaryConflictIn, SxactHasSummaryConflictOut, RWConflictData::sxactIn, SxactIsCommitted, SxactIsDoomed, SxactIsPrepared, SxactIsReadOnly, RWConflictData::sxactOut, and SERIALIZABLEXACT::topXid.
Referenced by FlagRWConflict().
bool PageIsPredicateLocked | ( | Relation | relation, |
BlockNumber | blkno | ||
) |
Definition at line 1990 of file predicate.c.
References RelFileNode::dbNode, HASH_FIND, hash_search_with_hash_value(), LW_SHARED, LWLockAcquire(), LWLockRelease(), PredicateLockHashPartitionLock, PredicateLockTargetTagHashCode, RelationData::rd_id, RelationData::rd_node, and SET_PREDICATELOCKTARGETTAG_PAGE.
void PostPrepare_PredicateLocks | ( | TransactionId | xid | ) |
Definition at line 5001 of file predicate.c.
References Assert, hash_destroy(), InvalidSerializableXact, MyXactDidWrite, SERIALIZABLEXACT::pid, and SxactIsPrepared.
Referenced by PrepareTransaction().
void PreCommit_CheckForSerializationFailure | ( | void | ) |
Definition at line 4831 of file predicate.c.
References Assert, ereport, errcode(), errdetail_internal(), errhint(), errmsg(), ERROR, SERIALIZABLEXACT::flags, SERIALIZABLEXACT::inConflicts, RWConflictData::inLink, InvalidSerializableXact, IsolationIsSerializable, PredXactListData::LastSxactCommitSeqNo, LW_EXCLUSIVE, LWLockAcquire(), LWLockRelease(), offsetof, SERIALIZABLEXACT::prepareSeqNo, SHMQueueNext(), SXACT_FLAG_DOOMED, SXACT_FLAG_PREPARED, SxactIsCommitted, SxactIsDoomed, SxactIsPartiallyReleased, SxactIsPrepared, SxactIsReadOnly, and RWConflictData::sxactOut.
Referenced by CommitTransaction(), and PrepareTransaction().
Definition at line 1417 of file predicate.c.
References Assert, PREDICATELOCKTAG::myTarget, PredicateLockHashCodeFromTargetHashCode, PredicateLockTargetTagHashCode, and PREDICATELOCKTARGET::tag.
Referenced by InitPredicateLocks().
void predicatelock_twophase_recover | ( | TransactionId | xid, |
uint16 | info, | ||
void * | recdata, | ||
uint32 | len | ||
) |
Definition at line 5050 of file predicate.c.
References Assert, VirtualTransactionId::backendId, SERIALIZABLEXACT::commitSeqNo, CreatePredicateLock(), CreatePredXact(), TwoPhasePredicateRecord::data, ereport, errcode(), errmsg(), ERROR, SERIALIZABLEXACT::finishedBefore, SERIALIZABLEXACT::finishedLink, SERIALIZABLEXACT::flags, TwoPhasePredicateXactRecord::flags, HASH_ENTER, HASH_FIND, hash_search(), SERIALIZABLEXACT::inConflicts, InvalidBackendId, InvalidSerCommitSeqNo, InvalidSerializableXact, InvalidTransactionId, SERIALIZABLEXACT::lastCommitBeforeSnapshot, VirtualTransactionId::localTransactionId, TwoPhasePredicateRecord::lockRecord, LW_EXCLUSIVE, LW_SHARED, LWLockAcquire(), LWLockRelease(), max_prepared_xacts, MaxBackends, SERIALIZABLEXID::myXact, SERIALIZABLEXACT::outConflicts, SERIALIZABLEXACT::pid, SERIALIZABLEXACT::possibleUnsafeConflicts, SERIALIZABLEXACT::predicateLocks, PredicateLockTargetTagHashCode, SERIALIZABLEXACT::prepareSeqNo, RecoverySerCommitSeqNo, SERIALIZABLEXACT::SeqNo, SerialSetActiveSerXmin(), SHMQueueElemInit(), SHMQueueInit(), SXACT_FLAG_SUMMARY_CONFLICT_IN, SXACT_FLAG_SUMMARY_CONFLICT_OUT, PredXactListData::SxactGlobalXmin, PredXactListData::SxactGlobalXminCount, SxactIsPrepared, SxactIsReadOnly, TwoPhasePredicateLockRecord::target, SERIALIZABLEXACT::topXid, TransactionIdEquals, TransactionIdFollows(), TransactionIdIsValid, TWOPHASEPREDICATERECORD_LOCK, TWOPHASEPREDICATERECORD_XACT, TwoPhasePredicateRecord::type, SERIALIZABLEXACT::vxid, PredXactListData::WritableSxactCount, TwoPhasePredicateRecord::xactRecord, SERIALIZABLEXIDTAG::xid, SERIALIZABLEXACT::xmin, and TwoPhasePredicateXactRecord::xmin.
|
static |
Definition at line 2510 of file predicate.c.
References CheckAndPromotePredicateLockRequest(), LOCALPREDICATELOCK::childLocks, CoarserLockCovers(), CreatePredicateLock(), DeleteChildTargetLocks(), GET_PREDICATELOCKTARGETTAG_TYPE, HASH_ENTER, hash_search_with_hash_value(), LOCALPREDICATELOCK::held, PredicateLockExists(), PredicateLockTargetTagHashCode, and PREDLOCKTAG_TUPLE.
Referenced by CheckAndPromotePredicateLockRequest(), PredicateLockPage(), PredicateLockRelation(), and PredicateLockTID().
|
static |
Definition at line 2027 of file predicate.c.
References HASH_FIND, hash_search(), and LOCALPREDICATELOCK::held.
Referenced by CoarserLockCovers(), PredicateLockAcquire(), and PredicateLockTID().
Definition at line 495 of file predicate.c.
References FirstBootstrapObjectId, RelationData::rd_id, RelationData::rd_rel, and RelationUsesLocalBuffers.
Referenced by DropAllPredicateLocksFromTable(), PredicateLockPageSplit(), SerializationNeededForRead(), and SerializationNeededForWrite().
void PredicateLockPage | ( | Relation | relation, |
BlockNumber | blkno, | ||
Snapshot | snapshot | ||
) |
Definition at line 2592 of file predicate.c.
References RelFileNode::dbNode, PredicateLockAcquire(), RelationData::rd_id, RelationData::rd_node, SerializationNeededForRead(), and SET_PREDICATELOCKTARGETTAG_PAGE.
Referenced by _bt_endpoint(), _bt_first(), _bt_readnextpage(), _hash_first(), _hash_readnext(), collectMatchBitmap(), gistScanPage(), IndexOnlyNext(), moveRightIfItNeeded(), scanPendingInsert(), and startScanEntry().
void PredicateLockPageCombine | ( | Relation | relation, |
BlockNumber | oldblkno, | ||
BlockNumber | newblkno | ||
) |
Definition at line 3252 of file predicate.c.
References PredicateLockPageSplit().
Referenced by _bt_mark_page_halfdead(), and ginDeletePage().
void PredicateLockPageSplit | ( | Relation | relation, |
BlockNumber | oldblkno, | ||
BlockNumber | newblkno | ||
) |
Definition at line 3167 of file predicate.c.
References Assert, BlockNumberIsValid, RelFileNode::dbNode, GetParentPredicateLockTag(), LW_EXCLUSIVE, LWLockAcquire(), LWLockRelease(), PredicateLockingNeededForRelation(), RelationData::rd_id, RelationData::rd_node, SET_PREDICATELOCKTARGETTAG_PAGE, success, PredXactListData::SxactGlobalXmin, TransactionIdIsValid, and TransferPredicateLocksToNewTarget().
Referenced by _bt_insertonpg(), _hash_splitbucket(), createPostingTree(), ginPlaceToPage(), gistplacetopage(), and PredicateLockPageCombine().