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 |
Definition at line 330 of file lmgr.c.
References LockRelId::dbId, LockHeldByMe(), LockInfoData::lockRelId, RelationData::rd_lockInfo, LockRelId::relId, and SET_LOCKTAG_RELATION.
Referenced by addRangeTableEntryForRelation(), ExecGetRangeTableRelation(), relation_open(), and try_relation_open().
Definition at line 347 of file lmgr.c.
References LockHeldByMe(), and SetLocktagRelationOid().
Referenced by build_index_value_desc(), ReportApplyConflict(), and SetRelationHasSubclass().
Definition at line 1018 of file lmgr.c.
References AcceptInvalidationMessages(), LOCKACQUIRE_ALREADY_CLEAR, LOCKACQUIRE_NOT_AVAIL, LockAcquireExtended(), MarkLockClear(), MyDatabaseId, res, and SET_LOCKTAG_OBJECT.
Referenced by do_autovacuum().
bool ConditionalLockPage | ( | Relation | relation, |
BlockNumber | blkno, | ||
LOCKMODE | lockmode | ||
) |
Definition at line 522 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 275 of file lmgr.c.
References AcceptInvalidationMessages(), LockRelId::dbId, LOCKACQUIRE_ALREADY_CLEAR, LOCKACQUIRE_NOT_AVAIL, LockAcquireExtended(), LockInfoData::lockRelId, MarkLockClear(), RelationData::rd_lockInfo, LockRelId::relId, res, and SET_LOCKTAG_RELATION.
Referenced by lazy_truncate_heap().
Definition at line 438 of file lmgr.c.
References LockRelId::dbId, LockAcquire(), LOCKACQUIRE_NOT_AVAIL, LockInfoData::lockRelId, RelationData::rd_lockInfo, LockRelId::relId, and SET_LOCKTAG_RELATION_EXTEND.
Definition at line 151 of file lmgr.c.
References AcceptInvalidationMessages(), LOCKACQUIRE_ALREADY_CLEAR, LOCKACQUIRE_NOT_AVAIL, LockAcquireExtended(), MarkLockClear(), res, and SetLocktagRelationOid().
Referenced by AlterTableMoveAll(), do_autovacuum(), LockTableRecurse(), LockViewRecurse_walker(), RangeVarGetRelidExtended(), and vacuum_open_relation().
Definition at line 1097 of file lmgr.c.
References AcceptInvalidationMessages(), InvalidOid, LOCKACQUIRE_ALREADY_CLEAR, LOCKACQUIRE_NOT_AVAIL, LockAcquireExtended(), MarkLockClear(), res, and SET_LOCKTAG_OBJECT.
Referenced by EventTriggerOnLogin().
bool ConditionalLockTuple | ( | Relation | relation, |
ItemPointer | tid, | ||
LOCKMODE | lockmode | ||
) |
Definition at line 578 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 730 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 1233 of file lmgr.c.
References _, appendStringInfo(), buf, LOCKTAG_ADVISORY, LOCKTAG_APPLY_TRANSACTION, 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 1330 of file lmgr.c.
References LOCKTAG_LAST_TYPE, and LockTagTypeNames.
Referenced by pgstat_get_wait_event().
void LockApplyTransactionForSession | ( | Oid | suboid, |
TransactionId | xid, | ||
uint16 | objid, | ||
LOCKMODE | lockmode | ||
) |
Definition at line 1193 of file lmgr.c.
References LockAcquire(), MyDatabaseId, and SET_LOCKTAG_APPLY_TRANSACTION.
Referenced by pa_lock_stream(), and pa_lock_transaction().
void LockDatabaseFrozenIds | ( | LOCKMODE | lockmode | ) |
Definition at line 487 of file lmgr.c.
References LockAcquire(), MyDatabaseId, and SET_LOCKTAG_DATABASE_FROZEN_IDS.
Referenced by vac_update_datfrozenxid().
Definition at line 994 of file lmgr.c.
References AcceptInvalidationMessages(), LockAcquire(), MyDatabaseId, and SET_LOCKTAG_OBJECT.
Referenced by AcquireDeletionLock(), AddEnumLabel(), AlterPublication(), AlterPublicationOptions(), get_object_address(), LockSchemaList(), RangeVarGetAndCheckCreationNamespace(), and RenameEnumLabel().
Definition at line 363 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 503 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 244 of file lmgr.c.
References AcceptInvalidationMessages(), LockRelId::dbId, LOCKACQUIRE_ALREADY_CLEAR, LockAcquireExtended(), LockInfoData::lockRelId, MarkLockClear(), RelationData::rd_lockInfo, LockRelId::relId, res, and SET_LOCKTAG_RELATION.
Referenced by index_create().
Definition at line 420 of file lmgr.c.
References LockRelId::dbId, LockAcquire(), LockInfoData::lockRelId, RelationData::rd_lockInfo, LockRelId::relId, and SET_LOCKTAG_RELATION_EXTEND.
Referenced by brin_getinsertbuffer(), brin_page_cleanup(), btvacuumscan(), ExtendBufferedRelShared(), ExtendBufferedRelTo(), ginvacuumcleanup(), gistvacuumscan(), pgstat_index(), and spgvacuumscan().
Definition at line 184 of file lmgr.c.
References AcceptInvalidationMessages(), LockRelId::dbId, LOCKACQUIRE_ALREADY_CLEAR, LockAcquireExtended(), MarkLockClear(), LockRelId::relId, res, and SET_LOCKTAG_RELATION.
Referenced by CreateDatabaseUsingWalLog(), and ScanSourceDatabasePgClass().
Definition at line 387 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 108 of file lmgr.c.
References AcceptInvalidationMessages(), LOCKACQUIRE_ALREADY_CLEAR, LockAcquireExtended(), MarkLockClear(), res, and SetLocktagRelationOid().
Referenced by AcquireDeletionLock(), AcquireExecutorLocks(), AlterTableMoveAll(), ATExecAttachPartition(), ATExecDetachPartition(), ATPostAlterTypeCleanup(), binary_upgrade_replorigin_advance(), copy_table_data(), CreateTriggerFiringOn(), find_inheritance_children_extended(), heap_create_with_catalog(), heap_drop_with_catalog(), index_create(), IndexSetParentIndex(), InitCatCachePhase2(), load_critical_index(), lock_and_open_sequence(), LockTableRecurse(), LockViewRecurse_walker(), LogicalRepSyncTableStart(), pg_replication_origin_advance(), RangeVarCallbackForAttachIndex(), RangeVarCallbackForDropRelation(), RangeVarCallbackForReindexIndex(), RangeVarGetAndCheckCreationNamespace(), RangeVarGetRelidExtended(), RefreshMatViewByOid(), relation_open(), ScanQueryForLocks(), SequenceChangePersistence(), and try_relation_open().
Definition at line 1073 of file lmgr.c.
References AcceptInvalidationMessages(), InvalidOid, LockAcquire(), and SET_LOCKTAG_OBJECT.
Referenced by AcquireDeletionLock(), AddRoleMems(), AddSubscriptionRelState(), AlterSubscription(), clear_subscription_skip_lsn(), createdb(), DelRoleMems(), DisableSubscription(), drop_local_obsolete_slots(), DropRole(), DropSubscription(), get_db_info(), get_object_address(), InitPostgres(), PreCommit_Notify(), replorigin_drop_by_name(), SetDatabaseHasLoginEventTriggers(), shdepLockAndCheckObject(), synchronize_slots(), and UpdateSubscriptionRelState().
Definition at line 1153 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 558 of file lmgr.c.
References LockRelId::dbId, ItemPointerGetBlockNumber(), ItemPointerGetOffsetNumber(), LockAcquire(), LockInfoData::lockRelId, RelationData::rd_lockInfo, LockRelId::relId, and SET_LOCKTAG_TUPLE.
Referenced by AlterDatabase(), AlterDatabaseOwner(), AlterDatabaseRefreshColl(), ExecMergeMatched(), ExecModifyTable(), ExecUpdate(), heap_inplace_lock(), and movedb().
int RelationExtensionLockWaiterCount | ( | Relation | relation | ) |
Definition at line 455 of file lmgr.c.
References LockRelId::dbId, LockInfoData::lockRelId, LockWaiterCount(), RelationData::rd_lockInfo, LockRelId::relId, and SET_LOCKTAG_RELATION_EXTEND.
Referenced by RelationAddBlocks().
void RelationInitLockInfo | ( | Relation | relation | ) |
Definition at line 71 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 772 of file lmgr.c.
References ExclusiveLock, LockAcquire(), SET_LOCKTAG_SPECULATIVE_INSERTION, and speculativeInsertionToken.
Referenced by ExecInsert().
void SpeculativeInsertionLockRelease | ( | TransactionId | xid | ) |
Definition at line 798 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 814 of file lmgr.c.
References Assert, LockAcquire(), LockRelease(), SET_LOCKTAG_SPECULATIVE_INSERTION, ShareLock, token, and TransactionIdIsValid.
Referenced by _bt_doinsert(), and check_exclusion_or_unique_constraint().
void UnlockApplyTransactionForSession | ( | Oid | suboid, |
TransactionId | xid, | ||
uint16 | objid, | ||
LOCKMODE | lockmode | ||
) |
Definition at line 1211 of file lmgr.c.
References LockRelease(), MyDatabaseId, and SET_LOCKTAG_APPLY_TRANSACTION.
Referenced by pa_unlock_stream(), and pa_unlock_transaction().
Definition at line 1053 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 538 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 310 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 470 of file lmgr.c.
References LockRelId::dbId, LockRelease(), LockInfoData::lockRelId, RelationData::rd_lockInfo, LockRelId::relId, and SET_LOCKTAG_RELATION_EXTEND.
Referenced by brin_getinsertbuffer(), brin_page_cleanup(), btvacuumscan(), ExtendBufferedRelShared(), ExtendBufferedRelTo(), ginvacuumcleanup(), gistvacuumscan(), pgstat_index(), and spgvacuumscan().
Definition at line 212 of file lmgr.c.
References LockRelId::dbId, LockRelease(), LockRelId::relId, and SET_LOCKTAG_RELATION.
Referenced by CreateDatabaseUsingWalLog(), index_close(), relation_close(), and ScanSourceDatabasePgClass().
Definition at line 400 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 227 of file lmgr.c.
References LockRelease(), and SetLocktagRelationOid().
Referenced by AcquireExecutorLocks(), binary_upgrade_replorigin_advance(), do_autovacuum(), expand_vacuum_rel(), find_inheritance_children_extended(), InitCatCachePhase2(), load_critical_index(), LockTableRecurse(), LogicalRepSyncTableStart(), pg_replication_origin_advance(), RangeVarCallbackForAttachIndex(), RangeVarCallbackForDropRelation(), RangeVarCallbackForReindexIndex(), RangeVarGetAndCheckCreationNamespace(), RangeVarGetRelidExtended(), ReleaseDeletionLock(), RenameRelation(), ScanQueryForLocks(), and try_relation_open().
Definition at line 1132 of file lmgr.c.
References InvalidOid, LockRelease(), and SET_LOCKTAG_OBJECT.
Referenced by AddSubscriptionRelState(), AlterDatabaseSet(), createdb_failure_callback(), drop_local_obsolete_slots(), get_db_info(), get_object_address(), replorigin_drop_by_name(), and synchronize_slots().
Definition at line 1171 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 595 of file lmgr.c.
References LockRelId::dbId, ItemPointerGetBlockNumber(), ItemPointerGetOffsetNumber(), LockRelease(), LockInfoData::lockRelId, RelationData::rd_lockInfo, LockRelId::relId, and SET_LOCKTAG_TUPLE.
Referenced by AlterDatabase(), AlterDatabaseOwner(), AlterDatabaseRefreshColl(), AlterRelationNamespaceInternal(), ATExecSetRelOptions(), ExecGrant_common(), ExecGrant_Relation(), ExecMergeMatched(), ExecModifyTable(), ExecUpdate(), heap_inplace_lock(), heap_inplace_unlock(), movedb(), RelationSetNewRelfilenumber(), RenameDatabase(), RenameRelationInternal(), SetDatabaseHasLoginEventTriggers(), SetRelationTableSpace(), and update_relispartition().
Definition at line 975 of file lmgr.c.
References list_free(), list_make1, progress, and WaitForLockersMultiple().
Referenced by DefineIndex(), and index_drop().
Definition at line 897 of file lmgr.c.
References GetLockConflicts(), lappend(), lfirst, list_free_deep(), NIL, pgstat_progress_update_multi_param(), pgstat_progress_update_param(), PGPROC::pid, VirtualTransactionId::procNumber, ProcNumberGetProc(), progress, 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 633 of file lmgr.c.
References ExclusiveLock, LockRelease(), and SET_LOCKTAG_TRANSACTION.
Referenced by CommitSubTransaction().
void XactLockTableInsert | ( | TransactionId | xid | ) |
Definition at line 616 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 657 of file lmgr.c.
References Assert, callback(), XactLockTableWaitInfo::ctid, error_context_stack, GetTopTransactionIdIfAny(), ItemPointerIsValid(), LockAcquire(), LockRelease(), oper(), XactLockTableWaitInfo::oper, pg_usleep(), 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_inplace_lock(), heap_lock_tuple(), heap_lock_updated_tuple_rec(), heap_update(), heapam_index_build_range_scan(), heapam_tuple_lock(), RelationFindReplTupleByIndex(), RelationFindReplTupleSeq(), and SnapBuildWaitSnapshot().