PostgreSQL Source Code
git master
|
#include "lib/stringinfo.h"
#include "storage/itemptr.h"
#include "storage/lock.h"
#include "utils/rel.h"
Go to the source code of this file.
Typedefs | |
typedef enum XLTW_Oper | XLTW_Oper |
Enumerations | |
enum | XLTW_Oper { XLTW_None, XLTW_Update, XLTW_Delete, XLTW_Lock, XLTW_LockUpdated, XLTW_InsertIndex, XLTW_InsertIndexUnique, XLTW_FetchUpdated, XLTW_RecheckExclusionConstr } |
enum XLTW_Oper |
Enumerator | |
---|---|
XLTW_None | |
XLTW_Update | |
XLTW_Delete | |
XLTW_Lock | |
XLTW_LockUpdated | |
XLTW_InsertIndex | |
XLTW_InsertIndexUnique | |
XLTW_FetchUpdated | |
XLTW_RecheckExclusionConstr |
Definition at line 303 of file lmgr.c.
References LockRelId::dbId, elog, GetLockmodeName(), LockHeldByMe(), LockInfoData::lockRelId, LOCKTAG::locktag_lockmethodid, MaxLockMode, RelationData::rd_lockInfo, RelationGetRelationName, LockRelId::relId, SET_LOCKTAG_RELATION, and WARNING.
Referenced by addRangeTableEntryForRelation(), ExecGetRangeTableRelation(), relation_open(), and try_relation_open().
bool ConditionalLockPage | ( | Relation | relation, |
BlockNumber | blkno, | ||
LOCKMODE | lockmode | ||
) |
Definition at line 505 of file lmgr.c.
References LockRelId::dbId, LockAcquire(), LOCKACQUIRE_NOT_AVAIL, LockInfoData::lockRelId, RelationData::rd_lockInfo, LockRelId::relId, and SET_LOCKTAG_PAGE.
Referenced by ginInsertCleanup().
Definition at line 248 of file lmgr.c.
References AcceptInvalidationMessages(), LockRelId::dbId, LOCKACQUIRE_ALREADY_CLEAR, LOCKACQUIRE_NOT_AVAIL, LockAcquireExtended(), LockInfoData::lockRelId, MarkLockClear(), RelationData::rd_lockInfo, LockRelId::relId, and SET_LOCKTAG_RELATION.
Referenced by lazy_truncate_heap().
Definition at line 421 of file lmgr.c.
References LockRelId::dbId, LockAcquire(), LOCKACQUIRE_NOT_AVAIL, LockInfoData::lockRelId, RelationData::rd_lockInfo, LockRelId::relId, and SET_LOCKTAG_RELATION_EXTEND.
Referenced by RelationGetBufferForTuple().
Definition at line 152 of file lmgr.c.
References AcceptInvalidationMessages(), LOCKACQUIRE_ALREADY_CLEAR, LOCKACQUIRE_NOT_AVAIL, LockAcquireExtended(), MarkLockClear(), and SetLocktagRelationOid().
Referenced by AlterTableMoveAll(), do_autovacuum(), LockTableRecurse(), LockViewRecurse_walker(), RangeVarGetRelidExtended(), and vacuum_open_relation().
bool ConditionalLockTuple | ( | Relation | relation, |
ItemPointer | tid, | ||
LOCKMODE | lockmode | ||
) |
Definition at line 561 of file lmgr.c.
References LockRelId::dbId, ItemPointerGetBlockNumber, ItemPointerGetOffsetNumber, LockAcquire(), LOCKACQUIRE_NOT_AVAIL, LockInfoData::lockRelId, RelationData::rd_lockInfo, LockRelId::relId, and SET_LOCKTAG_TUPLE.
bool ConditionalXactLockTableWait | ( | TransactionId | xid | ) |
Definition at line 713 of file lmgr.c.
References Assert, GetTopTransactionIdIfAny(), LockAcquire(), LOCKACQUIRE_NOT_AVAIL, LockRelease(), pg_usleep(), SET_LOCKTAG_TRANSACTION, ShareLock, SubTransGetTopmostTransaction(), TransactionIdEquals, TransactionIdIsInProgress(), and TransactionIdIsValid.
Referenced by Do_MultiXactIdWait(), heap_lock_tuple(), and heapam_tuple_lock().
void DescribeLockTag | ( | StringInfo | buf, |
const LOCKTAG * | tag | ||
) |
Definition at line 1100 of file lmgr.c.
References _, appendStringInfo(), LOCKTAG_ADVISORY, LOCKTAG_DATABASE_FROZEN_IDS, LOCKTAG::locktag_field1, LOCKTAG::locktag_field2, LOCKTAG::locktag_field3, LOCKTAG::locktag_field4, LOCKTAG_OBJECT, LOCKTAG_PAGE, LOCKTAG_RELATION, LOCKTAG_RELATION_EXTEND, LOCKTAG_SPECULATIVE_TOKEN, LOCKTAG_TRANSACTION, LOCKTAG_TUPLE, LOCKTAG::locktag_type, LOCKTAG_USERLOCK, and LOCKTAG_VIRTUALTRANSACTION.
Referenced by DeadLockReport(), and ProcSleep().
const char* GetLockNameFromTagType | ( | uint16 | locktag_type | ) |
Definition at line 1190 of file lmgr.c.
References LOCKTAG_LAST_TYPE, and LockTagTypeNames.
Referenced by pgstat_get_wait_event().
void LockDatabaseFrozenIds | ( | LOCKMODE | lockmode | ) |
Definition at line 470 of file lmgr.c.
References LockAcquire(), MyDatabaseId, and SET_LOCKTAG_DATABASE_FROZEN_IDS.
Referenced by vac_update_datfrozenxid().
Definition at line 976 of file lmgr.c.
References AcceptInvalidationMessages(), LockAcquire(), MyDatabaseId, and SET_LOCKTAG_OBJECT.
Referenced by AcquireDeletionLock(), AddEnumLabel(), get_object_address(), RangeVarGetAndCheckCreationNamespace(), and RenameEnumLabel().
Definition at line 346 of file lmgr.c.
References LockRelId::dbId, LockHasWaiters(), LockInfoData::lockRelId, RelationData::rd_lockInfo, LockRelId::relId, and SET_LOCKTAG_RELATION.
Referenced by count_nondeletable_pages().
void LockPage | ( | Relation | relation, |
BlockNumber | blkno, | ||
LOCKMODE | lockmode | ||
) |
Definition at line 486 of file lmgr.c.
References LockRelId::dbId, LockAcquire(), LockInfoData::lockRelId, RelationData::rd_lockInfo, LockRelId::relId, and SET_LOCKTAG_PAGE.
Referenced by ginInsertCleanup().
Definition at line 217 of file lmgr.c.
References AcceptInvalidationMessages(), LockRelId::dbId, LOCKACQUIRE_ALREADY_CLEAR, LockAcquireExtended(), LockInfoData::lockRelId, MarkLockClear(), RelationData::rd_lockInfo, LockRelId::relId, and SET_LOCKTAG_RELATION.
Referenced by index_create().
Definition at line 403 of file lmgr.c.
References LockRelId::dbId, LockAcquire(), LockInfoData::lockRelId, RelationData::rd_lockInfo, LockRelId::relId, and SET_LOCKTAG_RELATION_EXTEND.
Referenced by _bt_getbuf(), BloomNewBuffer(), brin_getinsertbuffer(), brin_page_cleanup(), btvacuumscan(), fsm_extend(), GinNewBuffer(), ginvacuumcleanup(), gistNewBuffer(), gistvacuumscan(), pgstat_index(), RelationGetBufferForTuple(), revmap_physical_extend(), SpGistNewBuffer(), spgvacuumscan(), and vm_extend().
Definition at line 370 of file lmgr.c.
References LockRelId::dbId, LockAcquire(), LockRelId::relId, and SET_LOCKTAG_RELATION.
Referenced by DefineIndex(), index_drop(), ReindexRelationConcurrently(), and vacuum_rel().
Definition at line 109 of file lmgr.c.
References AcceptInvalidationMessages(), LOCKACQUIRE_ALREADY_CLEAR, LockAcquireExtended(), MarkLockClear(), and SetLocktagRelationOid().
Referenced by AcquireDeletionLock(), AcquireExecutorLocks(), AlterTableMoveAll(), ATExecAttachPartition(), ATExecDetachPartition(), ATPostAlterTypeCleanup(), copy_table_data(), CreateTrigger(), ExecRefreshMatView(), find_inheritance_children(), heap_drop_with_catalog(), InitCatCachePhase2(), load_critical_index(), lock_and_open_sequence(), LockTableRecurse(), LockViewRecurse_walker(), LogicalRepSyncTableStart(), pg_replication_origin_advance(), RangeVarCallbackForAttachIndex(), RangeVarCallbackForDropRelation(), RangeVarCallbackForReindexIndex(), RangeVarGetAndCheckCreationNamespace(), RangeVarGetRelidExtended(), relation_open(), ScanQueryForLocks(), and try_relation_open().
Definition at line 1017 of file lmgr.c.
References AcceptInvalidationMessages(), InvalidOid, LockAcquire(), and SET_LOCKTAG_OBJECT.
Referenced by AddSubscriptionRelState(), AlterSubscription(), DropRole(), DropSubscription(), get_db_info(), get_object_address(), InitPostgres(), PreCommit_Notify(), shdepLockAndCheckObject(), and UpdateSubscriptionRelState().
Definition at line 1059 of file lmgr.c.
References InvalidOid, LockAcquire(), and SET_LOCKTAG_OBJECT.
Referenced by dbase_redo(), and movedb().
void LockTuple | ( | Relation | relation, |
ItemPointer | tid, | ||
LOCKMODE | lockmode | ||
) |
Definition at line 541 of file lmgr.c.
References LockRelId::dbId, ItemPointerGetBlockNumber, ItemPointerGetOffsetNumber, LockAcquire(), LockInfoData::lockRelId, RelationData::rd_lockInfo, LockRelId::relId, and SET_LOCKTAG_TUPLE.
int RelationExtensionLockWaiterCount | ( | Relation | relation | ) |
Definition at line 438 of file lmgr.c.
References LockRelId::dbId, LockInfoData::lockRelId, LockWaiterCount(), RelationData::rd_lockInfo, LockRelId::relId, and SET_LOCKTAG_RELATION_EXTEND.
Referenced by RelationAddExtraBlocks().
void RelationInitLockInfo | ( | Relation | relation | ) |
Definition at line 72 of file lmgr.c.
References Assert, LockRelId::dbId, InvalidOid, LockInfoData::lockRelId, MyDatabaseId, OidIsValid, RelationData::rd_lockInfo, RelationData::rd_rel, RelationGetRelid, RelationIsValid, and LockRelId::relId.
Referenced by formrdesc(), load_relcache_init_file(), RelationBuildDesc(), and RelationBuildLocalRelation().
uint32 SpeculativeInsertionLockAcquire | ( | TransactionId | xid | ) |
Definition at line 755 of file lmgr.c.
References ExclusiveLock, LockAcquire(), SET_LOCKTAG_SPECULATIVE_INSERTION, and speculativeInsertionToken.
Referenced by ExecInsert().
void SpeculativeInsertionLockRelease | ( | TransactionId | xid | ) |
Definition at line 781 of file lmgr.c.
References ExclusiveLock, LockRelease(), SET_LOCKTAG_SPECULATIVE_INSERTION, and speculativeInsertionToken.
Referenced by ExecInsert().
void SpeculativeInsertionWait | ( | TransactionId | xid, |
uint32 | token | ||
) |
Definition at line 797 of file lmgr.c.
References Assert, LockAcquire(), LockRelease(), SET_LOCKTAG_SPECULATIVE_INSERTION, ShareLock, and TransactionIdIsValid.
Referenced by _bt_doinsert(), and check_exclusion_or_unique_constraint().
Definition at line 997 of file lmgr.c.
References LockRelease(), MyDatabaseId, and SET_LOCKTAG_OBJECT.
Referenced by get_object_address(), RangeVarGetAndCheckCreationNamespace(), and ReleaseDeletionLock().
void UnlockPage | ( | Relation | relation, |
BlockNumber | blkno, | ||
LOCKMODE | lockmode | ||
) |
Definition at line 521 of file lmgr.c.
References LockRelId::dbId, LockRelease(), LockInfoData::lockRelId, RelationData::rd_lockInfo, LockRelId::relId, and SET_LOCKTAG_PAGE.
Referenced by ginInsertCleanup().
Definition at line 283 of file lmgr.c.
References LockRelId::dbId, LockRelease(), LockInfoData::lockRelId, RelationData::rd_lockInfo, LockRelId::relId, and SET_LOCKTAG_RELATION.
Referenced by lazy_truncate_heap().
Definition at line 453 of file lmgr.c.
References LockRelId::dbId, LockRelease(), LockInfoData::lockRelId, RelationData::rd_lockInfo, LockRelId::relId, and SET_LOCKTAG_RELATION_EXTEND.
Referenced by _bt_getbuf(), BloomNewBuffer(), brin_getinsertbuffer(), brin_page_cleanup(), btvacuumscan(), fsm_extend(), GinNewBuffer(), ginvacuumcleanup(), gistNewBuffer(), gistvacuumscan(), pgstat_index(), RelationGetBufferForTuple(), revmap_physical_extend(), SpGistNewBuffer(), spgvacuumscan(), and vm_extend().
Definition at line 185 of file lmgr.c.
References LockRelId::dbId, LockRelease(), LockRelId::relId, and SET_LOCKTAG_RELATION.
Referenced by index_close(), and relation_close().
Definition at line 383 of file lmgr.c.
References LockRelId::dbId, LockRelease(), LockRelId::relId, and SET_LOCKTAG_RELATION.
Referenced by DefineIndex(), index_drop(), ReindexRelationConcurrently(), and vacuum_rel().
Definition at line 200 of file lmgr.c.
References LockRelease(), and SetLocktagRelationOid().
Referenced by AcquireExecutorLocks(), do_autovacuum(), expand_vacuum_rel(), find_inheritance_children(), InitCatCachePhase2(), load_critical_index(), LockTableRecurse(), LogicalRepSyncTableStart(), pg_replication_origin_advance(), RangeVarCallbackForAttachIndex(), RangeVarCallbackForDropRelation(), RangeVarCallbackForReindexIndex(), RangeVarGetAndCheckCreationNamespace(), RangeVarGetRelidExtended(), ReleaseDeletionLock(), ScanQueryForLocks(), and try_relation_open().
Definition at line 1038 of file lmgr.c.
References InvalidOid, LockRelease(), and SET_LOCKTAG_OBJECT.
Referenced by AlterDatabaseSet(), createdb_failure_callback(), get_db_info(), and get_object_address().
Definition at line 1077 of file lmgr.c.
References InvalidOid, LockRelease(), and SET_LOCKTAG_OBJECT.
Referenced by dbase_redo(), and movedb().
void UnlockTuple | ( | Relation | relation, |
ItemPointer | tid, | ||
LOCKMODE | lockmode | ||
) |
Definition at line 578 of file lmgr.c.
References LockRelId::dbId, ItemPointerGetBlockNumber, ItemPointerGetOffsetNumber, LockRelease(), LockInfoData::lockRelId, RelationData::rd_lockInfo, LockRelId::relId, and SET_LOCKTAG_TUPLE.
Definition at line 957 of file lmgr.c.
References list_free(), list_make1, and WaitForLockersMultiple().
Referenced by DefineIndex(), and index_drop().
Definition at line 879 of file lmgr.c.
References VirtualTransactionId::backendId, BackendIdGetProc(), GetLockConflicts(), lappend(), lfirst, list_free_deep(), list_length(), NIL, pgstat_progress_update_multi_param(), pgstat_progress_update_param(), PGPROC::pid, PROGRESS_WAITFOR_CURRENT_PID, PROGRESS_WAITFOR_DONE, PROGRESS_WAITFOR_TOTAL, values, VirtualTransactionIdIsValid, and VirtualXactLock().
Referenced by ATExecDetachPartition(), ReindexRelationConcurrently(), and WaitForLockers().
void XactLockTableDelete | ( | TransactionId | xid | ) |
Definition at line 616 of file lmgr.c.
References ExclusiveLock, LockRelease(), and SET_LOCKTAG_TRANSACTION.
Referenced by CommitSubTransaction().
void XactLockTableInsert | ( | TransactionId | xid | ) |
Definition at line 599 of file lmgr.c.
References ExclusiveLock, LockAcquire(), and SET_LOCKTAG_TRANSACTION.
Referenced by AssignTransactionId().
void XactLockTableWait | ( | TransactionId | xid, |
Relation | rel, | ||
ItemPointer | ctid, | ||
XLTW_Oper | oper | ||
) |
Definition at line 640 of file lmgr.c.
References ErrorContextCallback::arg, Assert, callback(), ErrorContextCallback::callback, XactLockTableWaitInfo::ctid, error_context_stack, GetTopTransactionIdIfAny(), ItemPointerIsValid, LockAcquire(), LockRelease(), XactLockTableWaitInfo::oper, pg_usleep(), ErrorContextCallback::previous, XactLockTableWaitInfo::rel, RelationIsValid, SET_LOCKTAG_TRANSACTION, ShareLock, SubTransGetTopmostTransaction(), TransactionIdEquals, TransactionIdIsInProgress(), TransactionIdIsValid, XactLockTableWaitErrorCb(), and XLTW_None.
Referenced by _bt_doinsert(), check_exclusion_or_unique_constraint(), Do_MultiXactIdWait(), heap_delete(), heap_lock_tuple(), heap_lock_updated_tuple_rec(), heap_update(), heapam_index_build_range_scan(), heapam_tuple_lock(), RelationFindReplTupleByIndex(), RelationFindReplTupleSeq(), and SnapBuildWaitSnapshot().