|
PostgreSQL Source Code git master
|
#include "postgres.h"#include <signal.h>#include <unistd.h>#include "access/transam.h"#include "access/twophase.h"#include "access/twophase_rmgr.h"#include "access/xlog.h"#include "access/xlogutils.h"#include "miscadmin.h"#include "pg_trace.h"#include "pgstat.h"#include "storage/lmgr.h"#include "storage/proc.h"#include "storage/procarray.h"#include "storage/shmem.h"#include "storage/spin.h"#include "storage/standby.h"#include "storage/subsystems.h"#include "utils/memutils.h"#include "utils/ps_status.h"#include "utils/resowner.h"
Go to the source code of this file.
Data Structures | |
| struct | TwoPhaseLockRecord |
| struct | FastPathStrongRelationLockData |
Typedefs | |
| typedef struct TwoPhaseLockRecord | TwoPhaseLockRecord |
Definition at line 276 of file lock.c.
| #define FAST_PATH_BIT_POSITION | ( | n, | |
| l | |||
| ) |
| #define FAST_PATH_BITS | ( | proc, | |
| n | |||
| ) | (proc)->fpLockBits[FAST_PATH_GROUP(n)] |
| #define FAST_PATH_CHECK_LOCKMODE | ( | proc, | |
| n, | |||
| l | |||
| ) | (FAST_PATH_BITS(proc, n) & (UINT64CONST(1) << FAST_PATH_BIT_POSITION(n, l))) |
| #define FAST_PATH_CLEAR_LOCKMODE | ( | proc, | |
| n, | |||
| l | |||
| ) | FAST_PATH_BITS(proc, n) &= ~(UINT64CONST(1) << FAST_PATH_BIT_POSITION(n, l)) |
| #define FAST_PATH_GET_BITS | ( | proc, | |
| n | |||
| ) | ((FAST_PATH_BITS(proc, n) >> (FAST_PATH_BITS_PER_SLOT * FAST_PATH_INDEX(n))) & FAST_PATH_MASK) |
| #define FAST_PATH_MASK ((1 << FAST_PATH_BITS_PER_SLOT) - 1) |
| #define FAST_PATH_REL_GROUP | ( | rel | ) | (((uint64) (rel) * 49157) & (FastPathLockGroupsPerBackend - 1)) |
| #define FAST_PATH_SET_LOCKMODE | ( | proc, | |
| n, | |||
| l | |||
| ) | FAST_PATH_BITS(proc, n) |= UINT64CONST(1) << FAST_PATH_BIT_POSITION(n, l) |
| #define FAST_PATH_STRONG_LOCK_HASH_PARTITIONS (1 << FAST_PATH_STRONG_LOCK_HASH_BITS) |
| #define FastPathStrongLockHashPartition | ( | hashcode | ) | ((hashcode) % FAST_PATH_STRONG_LOCK_HASH_PARTITIONS) |
| #define NLOCKENTS | ( | ) | mul_size(max_locks_per_xact, add_size(MaxBackends, max_prepared_xacts)) |
Definition at line 1869 of file lock.c.
References Assert, FastPathStrongRelationLockData::count, FastPathStrongLockHashPartition, FastPathStrongRelationLocks, fb(), FastPathStrongRelationLockData::mutex, SpinLockAcquire(), SpinLockRelease(), and StrongLockInProgress.
Referenced by LockAcquireExtended(), and LockErrorCleanup().
Definition at line 3485 of file lock.c.
References CheckForSessionAndXactLocks(), ereport, errcode(), errmsg, ERROR, FastPathGetRelationLockEntry(), fb(), hash_seq_init(), hash_seq_search(), i, LockMethodLocalHash, TwoPhaseLockRecord::lockmode, TwoPhaseLockRecord::locktag, LOCKTAG_VIRTUALTRANSACTION, memcpy(), RegisterTwoPhaseRecord(), and TWOPHASE_RM_LOCK_ID.
Referenced by PrepareTransaction().
Definition at line 1833 of file lock.c.
References Assert, FastPathStrongRelationLockData::count, FastPathStrongRelationLocks, fb(), FastPathStrongRelationLockData::mutex, SpinLockAcquire(), SpinLockRelease(), and StrongLockInProgress.
Referenced by LockAcquireExtended().
Definition at line 1473 of file lock.c.
References fb(), LOCALLOCK_LOCKTAG, and LOCKTAG_RELATION_EXTEND.
Referenced by GrantLockLocal(), and RemoveLocalLock().
Definition at line 3397 of file lock.c.
References CurrentMemoryContext, ereport, errcode(), errmsg, ERROR, fb(), HASH_BLOBS, HASH_CONTEXT, hash_create(), hash_destroy(), HASH_ELEM, HASH_ENTER, hash_search(), hash_seq_init(), hash_seq_search(), i, LockMethodLocalHash, and LOCKTAG_VIRTUALTRANSACTION.
Referenced by AtPrepare_Locks().
|
static |
Definition at line 1747 of file lock.c.
References Assert, dlist_delete(), dlist_is_empty(), elog, fb(), HASH_REMOVE, hash_search_with_hash_value(), PROCLOCK::holdMask, LOCK_PRINT, PROCLOCK::lockLink, LockMethodLockHash, LockMethodProcLockHash, LOCK::nRequested, PANIC, PROCLOCK::procLink, PROCLOCK_PRINT, ProcLockHashCode(), LOCK::procLocks, ProcLockWakeup(), LOCK::tag, and PROCLOCK::tag.
Referenced by LockRefindAndRelease(), LockRelease(), LockReleaseAll(), and RemoveFromWaitQueue().
Definition at line 621 of file lock.c.
References DEFAULT_LOCKMETHOD, fb(), LOCKBIT_ON, and LockMethods.
Referenced by Do_MultiXactIdWait(), DoesMultiXactIdConflict(), initialize_reloptions(), and test_lockmode_for_conflict().
Definition at line 2967 of file lock.c.
References DEFAULT_LOCKMETHOD, elog, ereport, errcode(), errhint(), errmsg, ERROR, FAST_PATH_CHECK_LOCKMODE, FAST_PATH_CLEAR_LOCKMODE, FAST_PATH_GET_BITS, FAST_PATH_REL_GROUP, FAST_PATH_SLOT, fb(), FP_LOCK_SLOTS_PER_GROUP, PGPROC::fpInfoLock, PGPROC::fpRelId, GrantLock(), HASH_FIND, hash_search_with_hash_value(), i, LockHashPartitionLock, LockMethodLockHash, LockMethodProcLockHash, LockMethods, LOCKTAG::locktag_field2, LW_EXCLUSIVE, LW_SHARED, LWLockAcquire(), LWLockRelease(), PROCLOCKTAG::myLock, MyProc, ProcLockHashCode(), SetupLockInTable(), and PROCLOCK::tag.
Referenced by AtPrepare_Locks().
Definition at line 2791 of file lock.c.
References Assert, FAST_PATH_CHECK_LOCKMODE, FAST_PATH_GET_BITS, FAST_PATH_REL_GROUP, FAST_PATH_SET_LOCKMODE, FAST_PATH_SLOT, FastPathLocalUseCounts, FastPathLockSlotsPerBackend, fb(), FP_LOCK_SLOTS_PER_GROUP, PGPROC::fpRelId, i, and MyProc.
Referenced by LockAcquireExtended().
|
static |
Definition at line 2870 of file lock.c.
References PROC_HDR::allProcCount, PGPROC::databaseId, FAST_PATH_BITS_PER_SLOT, FAST_PATH_CHECK_LOCKMODE, FAST_PATH_CLEAR_LOCKMODE, FAST_PATH_GET_BITS, FAST_PATH_LOCKNUMBER_OFFSET, FAST_PATH_REL_GROUP, FAST_PATH_SLOT, fb(), FP_LOCK_SLOTS_PER_GROUP, PGPROC::fpInfoLock, PGPROC::fpLockBits, PGPROC::fpRelId, GetPGProcByNumber, GrantLock(), i, j, LockHashPartitionLock, LOCKTAG::locktag_field1, LOCKTAG::locktag_field2, LW_EXCLUSIVE, LWLockAcquire(), LWLockRelease(), PROCLOCKTAG::myLock, ProcGlobal, SetupLockInTable(), and PROCLOCK::tag.
Referenced by LockAcquireExtended().
Definition at line 2834 of file lock.c.
References Assert, FAST_PATH_CHECK_LOCKMODE, FAST_PATH_CLEAR_LOCKMODE, FAST_PATH_GET_BITS, FAST_PATH_REL_GROUP, FAST_PATH_SLOT, FastPathLocalUseCounts, FP_LOCK_SLOTS_PER_GROUP, PGPROC::fpRelId, i, MyProc, and result.
Referenced by LockRelease(), and LockReleaseAll().
Definition at line 1859 of file lock.c.
References fb(), and StrongLockInProgress.
Referenced by LockAcquireExtended().
Definition at line 1907 of file lock.c.
References awaitedLock.
Referenced by LockErrorCleanup(), ProcessRecoveryConflictInterrupt(), and ProcSleep().
| BlockedProcsData * GetBlockerStatusData | ( | int | blocked_pid | ) |
Definition at line 3980 of file lock.c.
References Assert, BackendPidGetProcWithLock(), dlist_iter::cur, data, dlist_container, dlist_foreach, fb(), GetSingleProcBlockerStatusData(), i, PGPROC::lockGroupLeader, PGPROC::lockGroupMembers, LockHashPartitionLockByIndex, LW_SHARED, LWLockAcquire(), LWLockRelease(), MaxBackends, NUM_LOCK_PARTITIONS, palloc_array, and palloc_object.
Referenced by pg_blocking_pids().
| VirtualTransactionId * GetLockConflicts | ( | const LOCKTAG * | locktag, |
| LOCKMODE | lockmode, | ||
| int * | countp | ||
| ) |
Definition at line 3078 of file lock.c.
References PROC_HDR::allProcCount, ConflictsWithRelationFastPath, PGPROC::databaseId, dlist_container, dlist_foreach, elog, ERROR, FAST_PATH_GET_BITS, FAST_PATH_LOCKNUMBER_OFFSET, FAST_PATH_REL_GROUP, FAST_PATH_SLOT, fb(), FP_LOCK_SLOTS_PER_GROUP, PGPROC::fpInfoLock, PGPROC::fpLockBits, PGPROC::fpRelId, GET_VXID_FROM_PGPROC, GetPGProcByNumber, HASH_FIND, hash_search_with_hash_value(), PROCLOCK::holdMask, i, InHotStandby, INVALID_PROC_NUMBER, InvalidLocalTransactionId, j, lengthof, LockHashPartitionLock, LockMethodLockHash, LockMethods, LOCKTAG::locktag_field1, LOCKTAG::locktag_field2, LOCKTAG::locktag_lockmethodid, LockTagHashCode(), LW_SHARED, LWLockAcquire(), LWLockRelease(), max_prepared_xacts, MaxBackends, MemoryContextAlloc(), MyProc, PROCLOCKTAG::myProc, palloc0_array, PANIC, ProcGlobal, LOCK::procLocks, PROCLOCK::tag, TopMemoryContext, VirtualTransactionIdEquals, and VirtualTransactionIdIsValid.
Referenced by ProcSleep(), ResolveRecoveryConflictWithLock(), and WaitForLockersMultiple().
| const char * GetLockmodeName | ( | LOCKMETHODID | lockmethodid, |
| LOCKMODE | mode | ||
| ) |
Definition at line 4236 of file lock.c.
References Assert, fb(), lengthof, LockMethods, LockMethodData::lockModeNames, and mode.
Referenced by DeadLockReport(), LockAcquireExtended(), overexplain_range_table(), pg_lock_status(), ProcSleep(), and waitonlock_error_callback().
| LockMethod GetLocksMethodTable | ( | const LOCK * | lock | ) |
Definition at line 525 of file lock.c.
References Assert, fb(), lengthof, LOCK_LOCKMETHOD, and LockMethods.
Referenced by DeadLockCheck(), and FindLockCycleRecurseMember().
Definition at line 3777 of file lock.c.
References PROC_HDR::allProcCount, Assert, data, PGPROC::databaseId, ExclusiveLock, FAST_PATH_GET_BITS, FAST_PATH_LOCKNUMBER_OFFSET, FAST_PATH_SLOT, FastPathLockGroupsPerBackend, fb(), FP_LOCK_SLOTS_PER_GROUP, PGPROC::fpInfoLock, PGPROC::fpLocalTransactionId, PGPROC::fpLockBits, PGPROC::fpRelId, PGPROC::fpVXIDLock, GetPGProcByNumber, PROCLOCK::groupLeader, hash_get_num_entries(), hash_seq_init(), hash_seq_search(), PROCLOCK::holdMask, i, j, VirtualTransactionId::localTransactionId, LOCKBIT_ON, LockHashPartitionLockByIndex, LockMethodProcLockHash, LW_SHARED, LWLockAcquire(), LWLockRelease(), PGPROC::lxid, MaxBackends, memcpy(), PROCLOCKTAG::myLock, PROCLOCKTAG::myProc, NoLock, NUM_LOCK_PARTITIONS, palloc_array, palloc_object, pg_atomic_read_u64(), PGPROC::pid, ProcGlobal, VirtualTransactionId::procNumber, PGPROC::procNumber, repalloc(), SET_LOCKTAG_RELATION, SET_LOCKTAG_VIRTUALTRANSACTION, LOCK::tag, PROCLOCK::tag, PGPROC::vxid, PGPROC::waitLock, PGPROC::waitLockMode, and PGPROC::waitStart.
Referenced by pg_lock_status().
| LockMethod GetLockTagsMethodTable | ( | const LOCKTAG * | locktag | ) |
Definition at line 537 of file lock.c.
References Assert, fb(), lengthof, LockMethods, and LOCKTAG::locktag_lockmethodid.
Referenced by pg_blocking_pids().
| xl_standby_lock * GetRunningTransactionLocks | ( | int * | nlocks | ) |
Definition at line 4154 of file lock.c.
References AccessExclusiveLock, Assert, fb(), hash_get_num_entries(), hash_seq_init(), hash_seq_search(), PROCLOCK::holdMask, i, LOCKBIT_ON, LockHashPartitionLockByIndex, LockMethodProcLockHash, LOCKTAG::locktag_field1, LOCKTAG::locktag_field2, LOCKTAG_RELATION, LOCKTAG::locktag_type, LW_SHARED, LWLockAcquire(), LWLockRelease(), PROCLOCKTAG::myLock, PROCLOCKTAG::myProc, NUM_LOCK_PARTITIONS, palloc(), LOCK::tag, PROCLOCK::tag, TransactionIdIsValid, and PGPROC::xid.
Referenced by LogStandbySnapshot().
|
static |
Definition at line 4060 of file lock.c.
References data, dclist_count(), dclist_foreach, dlist_container, dlist_foreach, fb(), PROCLOCK::groupLeader, PROCLOCK::holdMask, PGPROC::lxid, Max, MaxBackends, memcpy(), PROCLOCKTAG::myLock, PROCLOCKTAG::myProc, NoLock, PGPROC::pid, PGPROC::procNumber, repalloc(), LOCK::tag, PROCLOCK::tag, PGPROC::vxid, PGPROC::waitLock, and PGPROC::waitLockMode.
Referenced by GetBlockerStatusData().
Definition at line 1898 of file lock.c.
References awaitedLock, awaitedOwner, and GrantLockLocal().
Referenced by LockErrorCleanup().
Definition at line 1667 of file lock.c.
References Assert, LOCK::granted, LOCK::grantMask, PROCLOCK::holdMask, LOCK_PRINT, LOCKBIT_OFF, LOCKBIT_ON, LOCK::nGranted, LOCK::nRequested, LOCK::requested, and LOCK::waitMask.
Referenced by FastPathGetRelationLockEntry(), FastPathTransferRelationLocks(), JoinWaitQueue(), lock_twophase_recover(), LockAcquireExtended(), ProcLockWakeup(), and VirtualXactLock().
|
static |
Definition at line 1801 of file lock.c.
References Assert, CheckAndSetLockHeld(), fb(), i, LOCALLOCKOWNER::nLocks, LOCALLOCKOWNER::owner, and ResourceOwnerRememberLock().
Referenced by GrantAwaitedLock(), and LockAcquireExtended().
Definition at line 503 of file lock.c.
References HASHCTL::entrysize, HASH_BLOBS, hash_create(), HASH_ELEM, HASHCTL::keysize, and LockMethodLocalHash.
Referenced by BaseInit().
| void lock_twophase_postabort | ( | FullTransactionId | fxid, |
| uint16 | info, | ||
| void * | recdata, | ||
| uint32 | len | ||
| ) |
Definition at line 4579 of file lock.c.
References fb(), len, and lock_twophase_postcommit().
| void lock_twophase_postcommit | ( | FullTransactionId | fxid, |
| uint16 | info, | ||
| void * | recdata, | ||
| uint32 | len | ||
| ) |
Definition at line 4553 of file lock.c.
References Assert, elog, ERROR, fb(), len, lengthof, LockMethods, TwoPhaseLockRecord::lockmode, LockRefindAndRelease(), TwoPhaseLockRecord::locktag, LOCKTAG::locktag_lockmethodid, and TwoPhaseGetDummyProc().
Referenced by lock_twophase_postabort().
| void lock_twophase_recover | ( | FullTransactionId | fxid, |
| uint16 | info, | ||
| void * | recdata, | ||
| uint32 | len | ||
| ) |
Definition at line 4340 of file lock.c.
References Assert, ConflictsWithRelationFastPath, FastPathStrongRelationLockData::count, dclist_init(), dlist_init(), dlist_is_empty(), dlist_push_tail(), elog, ereport, errcode(), errhint(), errmsg, ERROR, FastPathStrongLockHashPartition, FastPathStrongRelationLocks, fb(), LOCK::granted, GrantLock(), LOCK::grantMask, PROCLOCK::groupLeader, HASH_ENTER_NULL, HASH_REMOVE, hash_search_with_hash_value(), PROCLOCK::holdMask, len, lengthof, LOCK_PRINT, LOCKBIT_ON, PGPROC::lockGroupLeader, LockHashPartition, LockHashPartitionLock, PROCLOCK::lockLink, LockMethodLockHash, LockMethodProcLockHash, LockMethods, TwoPhaseLockRecord::lockmode, TwoPhaseLockRecord::locktag, LOCKTAG::locktag_field1, LOCKTAG::locktag_field2, LOCKTAG::locktag_field3, LOCKTAG::locktag_lockmethodid, LockTagHashCode(), LW_EXCLUSIVE, LWLockAcquire(), LWLockRelease(), MAX_LOCKMODES, MemSet, FastPathStrongRelationLockData::mutex, PGPROC::myProcLocks, LOCK::nGranted, LOCK::nRequested, PANIC, PROCLOCK::procLink, PROCLOCK_PRINT, ProcLockHashCode(), LOCK::procLocks, PROCLOCK::releaseMask, LOCK::requested, SpinLockAcquire(), SpinLockRelease(), LOCK::tag, TwoPhaseGetDummyProc(), LOCK::waitMask, and LOCK::waitProcs.
| void lock_twophase_standby_recover | ( | FullTransactionId | fxid, |
| uint16 | info, | ||
| void * | recdata, | ||
| uint32 | len | ||
| ) |
Definition at line 4521 of file lock.c.
References AccessExclusiveLock, Assert, elog, ERROR, fb(), len, lengthof, LockMethods, TwoPhaseLockRecord::lockmode, TwoPhaseLockRecord::locktag, LOCKTAG::locktag_field1, LOCKTAG::locktag_field2, LOCKTAG::locktag_lockmethodid, LOCKTAG_RELATION, LOCKTAG::locktag_type, StandbyAcquireAccessExclusiveLock(), and XidFromFullTransactionId.
| LockAcquireResult LockAcquire | ( | const LOCKTAG * | locktag, |
| LOCKMODE | lockmode, | ||
| bool | sessionLock, | ||
| bool | dontWait | ||
| ) |
Definition at line 807 of file lock.c.
References fb(), and LockAcquireExtended().
Referenced by ConditionalLockPage(), ConditionalLockRelationForExtension(), LockApplyTransactionForSession(), LockDatabaseFrozenIds(), LockDatabaseObject(), LockPage(), LockRelationForExtension(), LockRelationIdForSession(), LockSharedObject(), LockSharedObjectForSession(), LockTuple(), pg_advisory_lock_int4(), pg_advisory_lock_int8(), pg_advisory_lock_shared_int4(), pg_advisory_lock_shared_int8(), pg_advisory_xact_lock_int4(), pg_advisory_xact_lock_int8(), pg_advisory_xact_lock_shared_int4(), pg_advisory_xact_lock_shared_int8(), pg_try_advisory_lock_int4(), pg_try_advisory_lock_int8(), pg_try_advisory_lock_shared_int4(), pg_try_advisory_lock_shared_int8(), pg_try_advisory_xact_lock_int4(), pg_try_advisory_xact_lock_int8(), pg_try_advisory_xact_lock_shared_int4(), pg_try_advisory_xact_lock_shared_int8(), SearchSysCacheLocked1(), SpeculativeInsertionLockAcquire(), SpeculativeInsertionWait(), StandbyAcquireAccessExclusiveLock(), VirtualXactLock(), XactLockForVirtualXact(), XactLockTableInsert(), and XactLockTableWait().
| LockAcquireResult LockAcquireExtended | ( | const LOCKTAG * | locktag, |
| LOCKMODE | lockmode, | ||
| bool | sessionLock, | ||
| bool | dontWait, | ||
| bool | reportMemoryError, | ||
| LOCALLOCK ** | locallockp, | ||
| bool | logLockFailure | ||
| ) |
Definition at line 834 of file lock.c.
References AbortStrongLockAcquire(), AccessExclusiveLock, Assert, BeginStrongLockAcquire(), buf, ConflictsWithRelationFastPath, FastPathStrongRelationLockData::count, CurrentResourceOwner, DeadLockReport(), DescribeLockTag(), dlist_delete(), EligibleForRelationFastPath, elog, ereport, errcode(), errdetail_log_plural(), errhint(), errmsg, ERROR, FAST_PATH_REL_GROUP, FastPathGrantRelationLock(), FastPathLocalUseCounts, FastPathStrongLockHashPartition, FastPathStrongRelationLocks, FastPathTransferRelationLocks(), fb(), FinishStrongLockAcquire(), FP_LOCK_SLOTS_PER_GROUP, PGPROC::fpInfoLock, GetLockHoldersAndWaiters(), GetLockmodeName(), GrantLock(), GrantLockLocal(), HASH_ENTER, HASH_REMOVE, hash_search(), hash_search_with_hash_value(), PROCLOCK::holdMask, initStringInfo(), InRecovery, JoinWaitQueue(), lengthof, LOCK_PRINT, LOCKACQUIRE_ALREADY_CLEAR, LOCKACQUIRE_ALREADY_HELD, LOCKACQUIRE_NOT_AVAIL, LOCKACQUIRE_OK, LOCKBIT_ON, LockCheckConflicts(), LockHashPartitionLock, PROCLOCK::lockLink, LockMethodLocalHash, LockMethodProcLockHash, LockMethods, LOCKTAG::locktag_field1, LOCKTAG::locktag_field2, LOCKTAG::locktag_lockmethodid, LOCKTAG_OBJECT, LOCKTAG_RELATION, LOCKTAG::locktag_type, LockTagHashCode(), LOG, LogAccessExclusiveLock(), LogAccessExclusiveLockPrepare(), LW_EXCLUSIVE, LW_SHARED, LWLockAcquire(), LWLockRelease(), MemoryContextAlloc(), MemSet, PROCLOCKTAG::myLock, MyProc, MyProcPid, LOCK::nGranted, LOCK::nRequested, PANIC, pfree(), pgstat_count_lock_fastpath_exceeded(), PROC_WAIT_STATUS_ERROR, PROC_WAIT_STATUS_OK, PROC_WAIT_STATUS_WAITING, PROCLOCK::procLink, PROCLOCK_PRINT, ProcLockHashCode(), RecoveryInProgress(), RemoveLocalLock(), repalloc(), LOCK::requested, RowExclusiveLock, SetupLockInTable(), PROCLOCK::tag, TopMemoryContext, LOCK::waitMask, WaitOnLock(), and XLogStandbyInfoActive.
Referenced by ConditionalLockDatabaseObject(), ConditionalLockRelation(), ConditionalLockRelationOid(), ConditionalLockSharedObject(), ConditionalLockTuple(), ConditionalXactLockTableWait(), LockAcquire(), LockRelation(), LockRelationId(), and LockRelationOid().
| bool LockCheckConflicts | ( | LockMethod | lockMethodTable, |
| LOCKMODE | lockmode, | ||
| LOCK * | lock, | ||
| PROCLOCK * | proclock | ||
| ) |
Definition at line 1538 of file lock.c.
References Assert, dlist_container, dlist_foreach, elog, fb(), LOCK::granted, LOCK::grantMask, PROCLOCK::groupLeader, PROCLOCK::holdMask, i, LOCK_LOCKTAG, LOCKBIT_ON, PGPROC::lockGroupLeader, LOCKTAG_RELATION_EXTEND, MAX_LOCKMODES, MyProc, PROCLOCKTAG::myProc, PANIC, PROCLOCK_PRINT, LOCK::procLocks, and PROCLOCK::tag.
Referenced by JoinWaitQueue(), LockAcquireExtended(), and ProcLockWakeup().
Definition at line 694 of file lock.c.
References elog, ERROR, fb(), HASH_FIND, hash_search(), PROCLOCK::holdMask, lengthof, LOCK_PRINT, LOCKBIT_ON, LockHashPartitionLock, LockMethodLocalHash, LockMethods, LOCKTAG::locktag_field1, LOCKTAG::locktag_field2, LOCKTAG::locktag_lockmethodid, LOG, LW_SHARED, LWLockAcquire(), LWLockRelease(), MemSet, PROCLOCK_PRINT, RemoveLocalLock(), LOCK::waitMask, and WARNING.
Referenced by LockHasWaitersRelation().
Definition at line 641 of file lock.c.
References fb(), HASH_FIND, hash_search(), LockHeldByMe(), LockMethodLocalHash, MaxLockMode, and MemSet.
Referenced by CheckRelationLockedByMe(), CheckRelationOidLockedByMe(), LockHeldByMe(), and UpdateSubscriptionRelState().
Definition at line 494 of file lock.c.
References FastPathStrongRelationLocks, FastPathStrongRelationLockData::mutex, and SpinLockInit().
Definition at line 451 of file lock.c.
References FastPathStrongRelationLocks, fb(), HASH_BLOBS, HASH_ELEM, HASH_FUNCTION, HASH_PARTITION, HTAB::keysize, LockMethodLockHash, LockMethodProcLockHash, name, NLOCKENTS, NUM_LOCK_PARTITIONS, proclock_hash(), ShmemRequestHash, and ShmemRequestStruct.
Definition at line 2715 of file lock.c.
References Assert, CurrentResourceOwner, fb(), hash_seq_init(), hash_seq_search(), i, LockMethodLocalHash, LockReassignOwner(), and ResourceOwnerGetParent().
Referenced by ResourceOwnerReleaseInternal().
|
static |
Definition at line 2745 of file lock.c.
References CurrentResourceOwner, fb(), i, LOCALLOCKOWNER::nLocks, LOCALLOCKOWNER::owner, ResourceOwnerForgetLock(), and ResourceOwnerRememberLock().
Referenced by LockReassignCurrentOwner().
|
static |
Definition at line 3293 of file lock.c.
References Assert, CleanUpLock(), ConflictsWithRelationFastPath, FastPathStrongRelationLockData::count, elog, FastPathStrongLockHashPartition, FastPathStrongRelationLocks, fb(), HASH_FIND, hash_search_with_hash_value(), PROCLOCK::holdMask, LOCKBIT_ON, LockHashPartitionLock, LockMethodLockHash, LockMethodProcLockHash, LockTagHashCode(), LW_EXCLUSIVE, LWLockAcquire(), LWLockRelease(), FastPathStrongRelationLockData::mutex, PANIC, PROCLOCK_PRINT, ProcLockHashCode(), SpinLockAcquire(), SpinLockRelease(), UnGrantLock(), and WARNING.
Referenced by lock_twophase_postcommit(), LockReleaseAll(), and VirtualXactLockTableCleanup().
Definition at line 2111 of file lock.c.
References Assert, CleanUpLock(), CurrentResourceOwner, EligibleForRelationFastPath, elog, ERROR, FAST_PATH_REL_GROUP, FastPathLocalUseCounts, FastPathUnGrantRelationLock(), fb(), PGPROC::fpInfoLock, HASH_FIND, hash_search(), hash_search_with_hash_value(), PROCLOCK::holdMask, i, lengthof, LOCK_PRINT, LOCKBIT_ON, LockHashPartitionLock, LockMethodLocalHash, LockMethodLockHash, LockMethodProcLockHash, LockMethods, LOCKTAG::locktag_field1, LOCKTAG::locktag_field2, LOCKTAG::locktag_lockmethodid, LOG, LW_EXCLUSIVE, LWLockAcquire(), LWLockRelease(), MemSet, MyProc, PROCLOCK_PRINT, RemoveLocalLock(), ResourceOwnerForgetLock(), UnGrantLock(), and WARNING.
Referenced by ConditionalXactLockTableWait(), pg_advisory_unlock_int4(), pg_advisory_unlock_int8(), pg_advisory_unlock_shared_int4(), pg_advisory_unlock_shared_int8(), ReleaseLockIfHeld(), SearchSysCacheLocked1(), SpeculativeInsertionLockRelease(), SpeculativeInsertionWait(), StandbyReleaseXidEntryLocks(), UnlockApplyTransactionForSession(), UnlockDatabaseObject(), UnlockPage(), UnlockRelation(), UnlockRelationForExtension(), UnlockRelationId(), UnlockRelationIdForSession(), UnlockRelationOid(), UnlockSharedObject(), UnlockSharedObjectForSession(), UnlockTuple(), VirtualXactLock(), XactLockForVirtualXact(), XactLockTableDelete(), and XactLockTableWait().
| void LockReleaseAll | ( | LOCKMETHODID | lockmethodid, |
| bool | allLocks | ||
| ) |
Definition at line 2316 of file lock.c.
References Assert, CleanUpLock(), DEFAULT_LOCKMETHOD, dlist_container, dlist_foreach_modify, dlist_is_empty(), EligibleForRelationFastPath, elog, ERROR, FastPathUnGrantRelationLock(), fb(), PGPROC::fpInfoLock, LOCK::grantMask, hash_seq_init(), hash_seq_search(), PROCLOCK::holdMask, i, lengthof, LOCALLOCK_LOCKMETHOD, LOCALLOCK_LOCKTAG, LOCK_LOCKMETHOD, LOCK_PRINT, LOCKBIT_ON, LockHashPartitionLockByIndex, LockMethodLocalHash, LockMethods, LockRefindAndRelease(), LOCKTAG_TUPLE, LockTagHashCode(), LOG, LW_EXCLUSIVE, LWLockAcquire(), LWLockRelease(), PROCLOCKTAG::myLock, MyProc, PROCLOCKTAG::myProc, PGPROC::myProcLocks, LOCK::nGranted, LOCALLOCKOWNER::nLocks, LOCK::nRequested, NUM_LOCK_PARTITIONS, LOCALLOCKOWNER::owner, PANIC, PROCLOCK_PRINT, PROCLOCK::releaseMask, RemoveLocalLock(), ResourceOwnerForgetLock(), LOCK::tag, PROCLOCK::tag, UnGrantLock(), VirtualXactLockTableCleanup(), and WARNING.
Referenced by DiscardAll(), logicalrep_worker_onexit(), ProcReleaseLocks(), and ShutdownPostgres().
Definition at line 2620 of file lock.c.
References fb(), hash_seq_init(), hash_seq_search(), i, LockMethodLocalHash, and ReleaseLockIfHeld().
Referenced by ResourceOwnerReleaseInternal().
| void LockReleaseSession | ( | LOCKMETHODID | lockmethodid | ) |
Definition at line 2590 of file lock.c.
References elog, ERROR, fb(), hash_seq_init(), hash_seq_search(), lengthof, LOCALLOCK_LOCKMETHOD, LockMethodLocalHash, LockMethods, and ReleaseLockIfHeld().
Referenced by pg_advisory_unlock_all().
Definition at line 555 of file lock.c.
References get_hash_value(), and LockMethodLockHash.
Referenced by CheckDeadLock(), GetLockConflicts(), lock_twophase_recover(), LockAcquireExtended(), LockRefindAndRelease(), LockReleaseAll(), LockWaiterCount(), proclock_hash(), and VirtualXactLock().
Definition at line 4837 of file lock.c.
References Assert, elog, ERROR, fb(), HASH_FIND, hash_search_with_hash_value(), lengthof, LockHashPartitionLock, LockMethodLockHash, LockMethods, LOCKTAG::locktag_lockmethodid, LockTagHashCode(), LW_EXCLUSIVE, LWLockAcquire(), LWLockRelease(), and LOCK::nRequested.
Referenced by RelationExtensionLockWaiterCount().
Definition at line 1929 of file lock.c.
Referenced by ConditionalLockDatabaseObject(), ConditionalLockRelation(), ConditionalLockRelationOid(), ConditionalLockSharedObject(), LockRelation(), LockRelationId(), and LockRelationOid().
| void PostPrepare_Locks | ( | FullTransactionId | fxid | ) |
Definition at line 3581 of file lock.c.
References Assert, dlist_container, dlist_delete(), dlist_foreach_modify, dlist_is_empty(), dlist_push_tail(), elog, END_CRIT_SECTION, ereport, errcode(), errmsg, fb(), LOCK::grantMask, PROCLOCK::groupLeader, hash_seq_init(), hash_seq_search(), hash_update_hash_key(), PROCLOCK::holdMask, i, LOCK_PRINT, LOCKBIT_ON, PGPROC::lockGroupLeader, LockHashPartitionLockByIndex, LockMethodLocalHash, LockMethodProcLockHash, LOCKTAG::locktag_type, LOCKTAG_VIRTUALTRANSACTION, LW_EXCLUSIVE, LWLockAcquire(), LWLockRelease(), PROCLOCKTAG::myLock, MyProc, PROCLOCKTAG::myProc, PGPROC::myProcLocks, LOCK::nGranted, LOCK::nRequested, NUM_LOCK_PARTITIONS, PANIC, PROCLOCK::procLink, PROCLOCK_PRINT, PROCLOCK::releaseMask, RemoveLocalLock(), START_CRIT_SECTION, LOCK::tag, PROCLOCK::tag, and TwoPhaseGetDummyProc().
Referenced by PrepareTransaction().
Definition at line 572 of file lock.c.
References Assert, DatumGetUInt32(), fb(), LockTagHashCode(), LOG2_NUM_LOCK_PARTITIONS, and PointerGetDatum().
Referenced by LockManagerShmemRequest().
|
inlinestatic |
Definition at line 603 of file lock.c.
References DatumGetUInt32(), fb(), LOG2_NUM_LOCK_PARTITIONS, and PointerGetDatum().
Referenced by CleanUpLock(), FastPathGetRelationLockEntry(), lock_twophase_recover(), LockAcquireExtended(), LockRefindAndRelease(), and SetupLockInTable().
Definition at line 2655 of file lock.c.
References Assert, CurrentResourceOwner, elog, fb(), i, LockRelease(), LOCALLOCKOWNER::nLocks, ResourceOwnerForgetLock(), and WARNING.
Referenced by LockReleaseCurrentOwner(), and LockReleaseSession().
Definition at line 2055 of file lock.c.
References Assert, CleanUpLock(), dclist_delete_from_thoroughly(), dclist_is_empty(), dlist_node_is_detached(), fb(), LOCK::granted, lengthof, LOCK_LOCKMETHOD, LOCKBIT_OFF, LockMethods, LOCK::nGranted, LOCK::nRequested, PROC_WAIT_STATUS_ERROR, PROC_WAIT_STATUS_WAITING, LOCK::requested, PGPROC::waitLink, PGPROC::waitLock, PGPROC::waitLockMode, LOCK::waitMask, PGPROC::waitProcLock, LOCK::waitProcs, and PGPROC::waitStatus.
Referenced by CheckDeadLock(), and LockErrorCleanup().
Definition at line 1485 of file lock.c.
References Assert, CheckAndSetLockHeld(), FastPathStrongRelationLockData::count, elog, FastPathStrongLockHashPartition, FastPathStrongRelationLocks, fb(), HASH_REMOVE, hash_search(), i, LockMethodLocalHash, FastPathStrongRelationLockData::mutex, pfree(), ResourceOwnerForgetLock(), SpinLockAcquire(), SpinLockRelease(), and WARNING.
Referenced by LockAcquireExtended(), LockHasWaiters(), LockRelease(), LockReleaseAll(), and PostPrepare_Locks().
Definition at line 1916 of file lock.c.
References awaitedLock, and fb().
Referenced by LockErrorCleanup().
|
static |
Definition at line 1292 of file lock.c.
References Assert, dclist_init(), dlist_init(), dlist_is_empty(), dlist_push_tail(), elog, ERROR, fb(), LOCK::granted, LOCK::grantMask, PROCLOCK::groupLeader, HASH_ENTER_NULL, HASH_REMOVE, hash_search_with_hash_value(), PROCLOCK::holdMask, i, LOCK_PRINT, LOCKBIT_ON, PGPROC::lockGroupLeader, LockHashPartition, PROCLOCK::lockLink, LockMethodLockHash, LockMethodProcLockHash, LOCKTAG::locktag_field1, LOCKTAG::locktag_field2, LOCKTAG::locktag_field3, LOG, MAX_LOCKMODES, MemSet, PGPROC::myProcLocks, LOCK::nGranted, LOCK::nRequested, PANIC, PROCLOCK::procLink, PROCLOCK_PRINT, ProcLockHashCode(), LOCK::procLocks, PROCLOCK::releaseMask, LOCK::requested, LOCK::tag, LOCK::waitMask, and LOCK::waitProcs.
Referenced by FastPathGetRelationLockEntry(), FastPathTransferRelationLocks(), LockAcquireExtended(), and VirtualXactLock().
|
static |
Definition at line 1690 of file lock.c.
References Assert, fb(), LOCK::granted, LOCK::grantMask, PROCLOCK::holdMask, LOCK_PRINT, LOCKBIT_OFF, LOCK::nGranted, LOCK::nRequested, PROCLOCK_PRINT, LOCK::requested, and LOCK::waitMask.
Referenced by LockRefindAndRelease(), LockRelease(), and LockReleaseAll().
| bool VirtualXactLock | ( | VirtualTransactionId | vxid, |
| bool | wait | ||
| ) |
Definition at line 4726 of file lock.c.
References Assert, DEFAULT_LOCKMETHOD, ereport, errcode(), errhint(), errmsg, ERROR, ExclusiveLock, fb(), PGPROC::fpInfoLock, PGPROC::fpLocalTransactionId, PGPROC::fpVXIDLock, GrantLock(), InvalidTransactionId, VirtualTransactionId::localTransactionId, LockAcquire(), LockHashPartitionLock, LockMethods, LockRelease(), LockTagHashCode(), LW_EXCLUSIVE, LWLockAcquire(), LWLockRelease(), PROCLOCKTAG::myLock, VirtualTransactionId::procNumber, PGPROC::procNumber, ProcNumberGetProc(), SET_LOCKTAG_VIRTUALTRANSACTION, SetupLockInTable(), ShareLock, PROCLOCK::tag, VirtualTransactionIdIsRecoveredPreparedXact, VirtualTransactionIdIsValid, PGPROC::vxid, XactLockForVirtualXact(), and PGPROC::xid.
Referenced by ResolveRecoveryConflictWithVirtualXIDs(), WaitForLockersMultiple(), and WaitForOlderSnapshots().
Definition at line 4626 of file lock.c.
References Assert, DEFAULT_LOCKMETHOD, ExclusiveLock, PGPROC::fpInfoLock, PGPROC::fpLocalTransactionId, PGPROC::fpVXIDLock, INVALID_PROC_NUMBER, InvalidLocalTransactionId, VirtualTransactionId::localTransactionId, LocalTransactionIdIsValid, LockMethods, LockRefindAndRelease(), LW_EXCLUSIVE, LWLockAcquire(), LWLockRelease(), MyProc, MyProcNumber, VirtualTransactionId::procNumber, PGPROC::procNumber, SET_LOCKTAG_VIRTUALTRANSACTION, and PGPROC::vxid.
Referenced by LockReleaseAll(), and ShutdownRecoveryTransactionEnvironment().
| void VirtualXactLockTableInsert | ( | VirtualTransactionId | vxid | ) |
Definition at line 4603 of file lock.c.
References Assert, PGPROC::fpInfoLock, PGPROC::fpLocalTransactionId, PGPROC::fpVXIDLock, InvalidLocalTransactionId, VirtualTransactionId::localTransactionId, LW_EXCLUSIVE, LWLockAcquire(), LWLockRelease(), MyProc, VirtualTransactionId::procNumber, PGPROC::procNumber, VirtualTransactionIdIsValid, and PGPROC::vxid.
Referenced by InitRecoveryTransactionEnvironment(), and StartTransaction().
|
static |
Definition at line 1941 of file lock.c.
References awaitedLock, awaitedOwner, error_context_stack, fb(), PG_CATCH, PG_END_TRY, PG_RE_THROW, PG_TRY, ErrorContextCallback::previous, ProcSleep(), result, set_ps_display_remove_suffix(), set_ps_display_suffix(), and waitonlock_error_callback().
Referenced by LockAcquireExtended().
Definition at line 2029 of file lock.c.
References arg, DescribeLockTag(), errcontext, fb(), GetLockmodeName(), initStringInfo(), LOCKTAG::locktag_lockmethodid, and mode.
Referenced by WaitOnLock().
|
static |
Definition at line 4675 of file lock.c.
References Assert, fb(), InvalidTransactionId, LockAcquire(), LOCKACQUIRE_NOT_AVAIL, LockRelease(), max_prepared_xacts, SET_LOCKTAG_TRANSACTION, ShareLock, TransactionIdIsValid, and TwoPhaseGetXidByVirtualXID().
Referenced by VirtualXactLock().
|
static |
Definition at line 339 of file lock.c.
Referenced by GetAwaitedLock(), GrantAwaitedLock(), ResetAwaitedLock(), and WaitOnLock().
|
static |
Definition at line 340 of file lock.c.
Referenced by GrantAwaitedLock(), and WaitOnLock().
|
static |
Definition at line 128 of file lock.c.
|
static |
Definition at line 179 of file lock.c.
Referenced by FastPathGrantRelationLock(), FastPathUnGrantRelationLock(), LockAcquireExtended(), and LockRelease().
| int FastPathLockGroupsPerBackend = 0 |
Definition at line 205 of file lock.c.
Referenced by CalculateFastPathLockShmemSize(), GetLockStatusData(), InitializeFastPathLocks(), and ProcGlobalShmemInit().
|
static |
Definition at line 315 of file lock.c.
Referenced by AbortStrongLockAcquire(), BeginStrongLockAcquire(), lock_twophase_recover(), LockAcquireExtended(), LockManagerShmemInit(), LockManagerShmemRequest(), LockRefindAndRelease(), and RemoveLocalLock().
Definition at line 111 of file lock.c.
| const ShmemCallbacks LockManagerShmemCallbacks |
|
static |
Definition at line 334 of file lock.c.
Referenced by AtPrepare_Locks(), CheckForSessionAndXactLocks(), InitLockManagerAccess(), LockAcquireExtended(), LockHasWaiters(), LockHeldByMe(), LockReassignCurrentOwner(), LockRelease(), LockReleaseAll(), LockReleaseCurrentOwner(), LockReleaseSession(), PostPrepare_Locks(), and RemoveLocalLock().
|
static |
Definition at line 332 of file lock.c.
Referenced by CleanUpLock(), FastPathGetRelationLockEntry(), GetLockConflicts(), lock_twophase_recover(), LockManagerShmemRequest(), LockRefindAndRelease(), LockRelease(), LockTagHashCode(), LockWaiterCount(), and SetupLockInTable().
|
static |
Definition at line 333 of file lock.c.
Referenced by CleanUpLock(), FastPathGetRelationLockEntry(), GetLockStatusData(), GetRunningTransactionLocks(), lock_twophase_recover(), LockAcquireExtended(), LockManagerShmemRequest(), LockRefindAndRelease(), LockRelease(), PostPrepare_Locks(), and SetupLockInTable().
|
static |
Definition at line 153 of file lock.c.
Referenced by DoLockModesConflict(), FastPathGetRelationLockEntry(), GetLockConflicts(), GetLockmodeName(), GetLocksMethodTable(), GetLockTagsMethodTable(), lock_twophase_postcommit(), lock_twophase_recover(), lock_twophase_standby_recover(), LockAcquireExtended(), LockHasWaiters(), LockRelease(), LockReleaseAll(), LockReleaseSession(), LockWaiterCount(), RemoveFromWaitQueue(), VirtualXactLock(), and VirtualXactLockTableCleanup().
Definition at line 57 of file lock.c.
Referenced by heap_acquire_tuplock(), heap_lock_tuple(), and heapam_tuple_lock().
| int max_locks_per_xact |
Definition at line 56 of file lock.c.
Referenced by CheckRequiredParameterValues(), InitControlFile(), InitializeFastPathLocks(), and XLogReportParameters().
|
static |
|
static |
Definition at line 338 of file lock.c.
Referenced by AbortStrongLockAcquire(), BeginStrongLockAcquire(), and FinishStrongLockAcquire().
|
static |
Definition at line 139 of file lock.c.