|
AddinShmemInitLock
- Waiting to manage space allocation in shared memory.
-
- |
- NotifySLRULock
- Waiting to access the NOTIFY message SLRU
- cache.
-
- |
- NotifyQueueLock
- Waiting to read or update NOTIFY messages.
+ Waiting to manage an extension's space allocation in shared
+ memory.
|
AutoFileLock
- Waiting to update the postgresql.auto.conf file.
+ Waiting to update the postgresql.auto.conf
+ file.
|
AutovacuumLock
- Autovacuum worker or launcher waiting to update or
- read the current state of autovacuum workers.
+ Waiting to read or update the current state of autovacuum
+ workers.
|
AutovacuumScheduleLock
- Waiting to ensure that the table selected for a vacuum
+ Waiting to ensure that a table selected for autovacuum
still needs vacuuming.
|
B-tree index.
|
- XactSLRULock
- Waiting to access the transaction status SLRU cache.
+ BufferContent
+ Waiting to access a data page in memory.
|
- XactTruncationLock
- Waiting to execute pg_xact_status or update
- the oldest transaction ID available to it.
+ BufferIO
+ Waiting for I/O on a data page.
+
+ |
+ BufferMapping
+ Waiting to associate a data block with a buffer in the buffer
+ pool.
|
CheckpointLock
- Waiting to perform checkpoint.
+ Waiting to begin a checkpoint.
|
CheckpointerCommLock
Waiting to manage fsync requests.
|
- CommitTsSLRULock
- Waiting to access the commit timestamp SLRU cache.
+ CommitTsLock
+ Waiting to read or update the last value set for a
+ transaction commit timestamp.
|
- CommitTsLock
- Waiting to read or update the last value set for the
- transaction timestamp.
+ CommitTsBuffer
+ Waiting for I/O on a commit timestamp SLRU buffer.
+
+ |
+ CommitTsSLRULock
+ Waiting to access the commit timestamp SLRU cache.
|
ControlFileLock
- Waiting to read or update the control file or creation of a
- new WAL file.
+ Waiting to read or update the pg_control
+ file or create a new WAL file.
|
DynamicSharedMemoryControlLock
- Waiting to read or update dynamic shared memory state.
+ Waiting to read or update dynamic shared memory allocation
+ information.
+
+ |
+ LockFastPath
+ Waiting to read or update a process' fast-path lock
+ information.
+
+ |
+ LockManager
+ Waiting to read or update information
+ about heavyweight
locks.
|
LogicalRepWorkerLock
- Waiting for action on logical replication worker to finish.
+ Waiting to read or update the state of logical replication
+ workers.
|
MultiXactGenLock
Waiting to read or update shared multixact state.
+ |
+ MultiXactMemberBuffer
+ Waiting for I/O on a multixact member SLRU buffer.
+
|
MultiXactMemberSLRULock
Waiting to access the multixact member SLRU cache.
+ |
+ MultiXactOffsetBuffer
+ Waiting for I/O on a multixact offset SLRU buffer.
+
|
MultiXactOffsetSLRULock
Waiting to access the multixact offset SLRU cache.
Waiting to read or truncate multixact information.
|
- OidGenLock
- Waiting to allocate or assign an OID.
+ NotifyBuffer
+ Waiting for I/O on a NOTIFY message SLRU
+ buffer.
|
- SerialSLRULock
- Waiting to access the serializable transaction conflict SLRU
- cache.
+ NotifyQueueLock
+ Waiting to read or update NOTIFY messages.
|
- OldSnapshotTimeMapLock
- Waiting to read or update old snapshot control information.
+ NotifySLRULock
+ Waiting to access the NOTIFY message SLRU
+ cache.
|
- ProcArrayLock
- Waiting to get a snapshot or clearing a transaction id at
- transaction end.
+ OidGenLock
+ Waiting to allocate a new OID.
|
- RelCacheInitLock
- Waiting to read or write relation cache initialization file.
+ OldSnapshotTimeMapLock
+ Waiting to read or update old snapshot control information.
|
- RelationMappingLock
- Waiting to update the relation map file used to store catalog
- to filenode mapping.
+ ParallelAppend
+ Waiting to choose the next subplan during Parallel Append plan
+ execution.
|
- ReplicationOriginLock
- Waiting to setup, drop or use replication origin.
+ ParallelHashJoin
+ Waiting to synchronize workers during Parallel Hash Join plan
+ execution.
|
- ReplicationSlotAllocationLock
- Waiting to allocate or free a replication slot.
+ ParallelQueryDSA
+ Waiting for parallel query dynamic shared memory allocation.
|
- ReplicationSlotControlLock
- Waiting to read or update replication slot state.
+ PerSessionDSA
+ Waiting for parallel query dynamic shared memory allocation.
|
- SInvalReadLock
- Waiting to retrieve or remove messages from shared invalidation
- queue.
+ PerSessionRecordType
+ Waiting to access a parallel query's information about composite
+ types.
|
- SInvalWriteLock
- Waiting to add a message in shared invalidation queue.
+ PerSessionRecordTypmod
+ Waiting to access a parallel query's information about type
+ modifiers that identify anonymous record types.
|
- SerializableFinishedListLock
- Waiting to access the list of finished serializable
- transactions.
+ PerXactPredicateList
+ Waiting to access the list of predicate locks held by the current
+ serializable transaction during a parallel query.
|
- SerializablePredicateLockListLock
- Waiting to perform an operation on a list of locks held by
+ PredicateLockManager
+ Waiting to access predicate lock information used by
serializable transactions.
|
- SerializableXactHashLock
- Waiting to retrieve or store information about serializable
- transactions.
+ ProcArrayLock
+ Waiting to access the shared per-process data structures
+ (typically, to get a snapshot or report a session's transaction
+ ID).
|
- ShmemIndexLock
- Waiting to find or allocate space in shared memory.
+ RelationMappingLock
+ Waiting to read or update
+ a pg_filenode.map file (used to track the
+ filenode assignments of certain system catalogs).
|
- SubtransSLRULock
- Waiting to access the sub-transaction SLRU cache.
+ RelCacheInitLock
+ Waiting to read or update a pg_internal.init
+ relation cache initialization file.
|
- SyncRepLock
- Waiting to read or update information about synchronous
- replicas.
+ ReplicationOriginLock
+ Waiting to create, drop or use a replication origin.
|
- SyncScanLock
- Waiting to get the start location of a scan on a table for
- synchronized scans.
+ ReplicationOriginState
+ Waiting to read or update the progress of one replication
+ origin.
|
- TablespaceCreateLock
- Waiting to create or drop the tablespace.
+ ReplicationSlotAllocationLock
+ Waiting to allocate or free a replication slot.
|
- TwoPhaseStateLock
- Waiting to read or update the state of prepared transactions.
+ ReplicationSlotControlLock
+ Waiting to read or update replication slot state.
|
- WALBufMappingLock
- Waiting to replace a page in WAL buffers.
+ ReplicationSlotIO
+ Waiting for I/O on a replication slot.
|
- WALWriteLock
- Waiting for WAL buffers to be written to disk.
+ SerialBuffer
+ Waiting for I/O on a serializable transaction conflict SLRU
+ buffer.
|
- XidGenLock
- Waiting to allocate or assign a transaction id.
+ SerializableFinishedListLock
+ Waiting to access the list of finished serializable
+ transactions.
|
- NotifyBuffer
- Waiting for I/O on a NOTIFY message SLRU
- buffer.
+ SerializablePredicateListLock
+ Waiting to access the list of predicate locks held by
+ serializable transactions.
|
- buffer_content
- Waiting to read or write a data page in memory.
+ SerializableXactHashLock
+ Waiting to read or update information about serializable
+ transactions.
|
- buffer_io
- Waiting for I/O on a data page.
+ SerialSLRULock
+ Waiting to access the serializable transaction conflict SLRU
+ cache.
|
- buffer_mapping
- Waiting to associate a data block with a buffer in the buffer
- pool.
+ SharedTidBitmap
+ Waiting to access a shared TID bitmap during a parallel bitmap
+ index scan.
|
- XactBuffer
- Waiting for I/O on a transaction status SLRU buffer.
+ SharedTupleStore
+ Waiting to access a shared tuple store during parallel
+ query.
|
- CommitTsBuffer
- Waiting for I/O on a commit timestamp SLRU buffer.
+ ShmemIndexLock
+ Waiting to find or allocate space in shared memory.
|
- lock_manager
- Waiting to add or examine locks for backends, or waiting to
- join or exit a locking group (used by parallel query).
+ SInvalReadLock
+ Waiting to retrieve messages from the shared catalog invalidation
+ queue.
|
- MultiXactMember
- Waiting for I/O on a multixact member SLRU buffer.
+ SInvalWriteLock
+ Waiting to add a message to the shared catalog invalidation
+ queue.
|
- MultiXactOffsetBuffer
- Waiting for I/O on a multixact offset SLRU buffer.
+ SubtransBuffer
+ Waiting for I/O on a sub-transaction SLRU buffer.
|
- SerialBuffer
- Waiting for I/O on a serializable transaction conflict SLRU
- buffer.
+ SubtransSLRULock
+ Waiting to access the sub-transaction SLRU cache.
|
- parallel_append
- Waiting to choose the next subplan during Parallel Append plan
- execution.
+ SyncRepLock
+ Waiting to read or update information about the state of
+ synchronous replication.
|
- parallel_hash_join
- Waiting to allocate or exchange a chunk of memory or update
- counters during Parallel Hash plan execution.
+ SyncScanLock
+ Waiting to select the starting location of a synchronized table
+ scan.
|
- parallel_query_dsa
- Waiting for parallel query dynamic shared memory allocation lock.
+ TablespaceCreateLock
+ Waiting to create or drop a tablespace.
|
- predicate_lock_manager
- Waiting to add or examine predicate lock information.
+ TwoPhaseStateLock
+ Waiting to read or update the state of prepared transactions.
|
- proc
- Waiting to read or update the fast-path lock information.
+ WALBufMappingLock
+ Waiting to replace a page in WAL buffers.
|
- replication_origin
- Waiting to read or update the replication progress.
+ WALInsert
+ Waiting to insert WAL data into a memory buffer.
|
- replication_slot_io
- Waiting for I/O on a replication slot.
+ WALWriteLock
+ Waiting for WAL buffers to be written to disk.
|
- serializable_xact
- Waiting to perform an operation on a serializable transaction
- in a parallel query.
+ XactBuffer
+ Waiting for I/O on a transaction status SLRU buffer.
|
- SubtransBuffer
- Waiting for I/O on a sub-transaction SLRU buffer.
+ XactSLRULock
+ Waiting to access the transaction status SLRU cache.
|
- tbm
- Waiting for TBM shared iterator lock.
+ XactTruncationLock
+ Waiting to execute pg_xact_status or update
+ the oldest transaction ID available to it.
|
- wal_insert
- Waiting to insert WAL into a memory buffer.
+ XidGenLock
+ Waiting to allocate a new transaction ID.
dsa_space = shm_toc_allocate(toc, SESSION_DSA_SIZE);
dsa = dsa_create_in_place(dsa_space,
SESSION_DSA_SIZE,
- LWTRANCHE_SESSION_DSA,
+ LWTRANCHE_PER_SESSION_DSA,
seg);
shm_toc_insert(toc, SESSION_KEY_DSA, dsa_space);
pg_atomic_add_fetch_u32(&ptchunks->refcount, 1);
/* Initialize the iterator lock */
- LWLockInitialize(&istate->lock, LWTRANCHE_TBM);
+ LWLockInitialize(&istate->lock, LWTRANCHE_SHARED_TIDBITMAP);
/* Initialize the shared iterator state */
istate->schunkbit = 0;
{
int i;
- replication_states_ctl->tranche_id = LWTRANCHE_REPLICATION_ORIGIN;
+ replication_states_ctl->tranche_id = LWTRANCHE_REPLICATION_ORIGIN_STATE;
MemSet(replication_states, 0, ReplicationOriginShmemSize());
/* everything else is zeroed by the memset above */
SpinLockInit(&slot->mutex);
- LWLockInitialize(&slot->io_in_progress_lock, LWTRANCHE_REPLICATION_SLOT_IO_IN_PROGRESS);
+ LWLockInitialize(&slot->io_in_progress_lock,
+ LWTRANCHE_REPLICATION_SLOT_IO);
ConditionVariableInit(&slot->active_cv);
}
}
LWTRANCHE_BUFFER_CONTENT);
LWLockInitialize(BufferDescriptorGetIOLock(buf),
- LWTRANCHE_BUFFER_IO_IN_PROGRESS);
+ LWTRANCHE_BUFFER_IO);
}
/* Correct last entry of linked list */
* FastPathStrongRelationLocks->counts becomes visible after we test
* it has yet to begin to transfer fast-path locks.
*/
- LWLockAcquire(&MyProc->backendLock, LW_EXCLUSIVE);
+ LWLockAcquire(&MyProc->fpInfoLock, LW_EXCLUSIVE);
if (FastPathStrongRelationLocks->count[fasthashcode] != 0)
acquired = false;
else
acquired = FastPathGrantRelationLock(locktag->locktag_field2,
lockmode);
- LWLockRelease(&MyProc->backendLock);
+ LWLockRelease(&MyProc->fpInfoLock);
if (acquired)
{
/*
* We might not find the lock here, even if we originally entered it
* here. Another backend may have moved it to the main table.
*/
- LWLockAcquire(&MyProc->backendLock, LW_EXCLUSIVE);
+ LWLockAcquire(&MyProc->fpInfoLock, LW_EXCLUSIVE);
released = FastPathUnGrantRelationLock(locktag->locktag_field2,
lockmode);
- LWLockRelease(&MyProc->backendLock);
+ LWLockRelease(&MyProc->fpInfoLock);
if (released)
{
RemoveLocalLock(locallock);
*/
if (!have_fast_path_lwlock)
{
- LWLockAcquire(&MyProc->backendLock, LW_EXCLUSIVE);
+ LWLockAcquire(&MyProc->fpInfoLock, LW_EXCLUSIVE);
have_fast_path_lwlock = true;
}
* transferred to the main lock table. That's going to require
* some extra work, so release our fast-path lock before starting.
*/
- LWLockRelease(&MyProc->backendLock);
+ LWLockRelease(&MyProc->fpInfoLock);
have_fast_path_lwlock = false;
/*
/* Done with the fast-path data structures */
if (have_fast_path_lwlock)
- LWLockRelease(&MyProc->backendLock);
+ LWLockRelease(&MyProc->fpInfoLock);
/*
* Now, scan each lock partition separately.
PGPROC *proc = &ProcGlobal->allProcs[i];
uint32 f;
- LWLockAcquire(&proc->backendLock, LW_EXCLUSIVE);
+ LWLockAcquire(&proc->fpInfoLock, LW_EXCLUSIVE);
/*
* If the target backend isn't referencing the same database as the
*
* proc->databaseId is set at backend startup time and never changes
* thereafter, so it might be safe to perform this test before
- * acquiring &proc->backendLock. In particular, it's certainly safe
- * to assume that if the target backend holds any fast-path locks, it
+ * acquiring &proc->fpInfoLock. In particular, it's certainly safe to
+ * assume that if the target backend holds any fast-path locks, it
* must have performed a memory-fencing operation (in particular, an
* LWLock acquisition) since setting proc->databaseId. However, it's
* less clear that our backend is certain to have performed a memory
*/
if (proc->databaseId != locktag->locktag_field1)
{
- LWLockRelease(&proc->backendLock);
+ LWLockRelease(&proc->fpInfoLock);
continue;
}
if (!proclock)
{
LWLockRelease(partitionLock);
- LWLockRelease(&proc->backendLock);
+ LWLockRelease(&proc->fpInfoLock);
return false;
}
GrantLock(proclock->tag.myLock, proclock, lockmode);
/* No need to examine remaining slots. */
break;
}
- LWLockRelease(&proc->backendLock);
+ LWLockRelease(&proc->fpInfoLock);
}
return true;
}
Oid relid = locktag->locktag_field2;
uint32 f;
- LWLockAcquire(&MyProc->backendLock, LW_EXCLUSIVE);
+ LWLockAcquire(&MyProc->fpInfoLock, LW_EXCLUSIVE);
for (f = 0; f < FP_LOCK_SLOTS_PER_BACKEND; f++)
{
if (!proclock)
{
LWLockRelease(partitionLock);
- LWLockRelease(&MyProc->backendLock);
+ LWLockRelease(&MyProc->fpInfoLock);
ereport(ERROR,
(errcode(ERRCODE_OUT_OF_MEMORY),
errmsg("out of shared memory"),
break;
}
- LWLockRelease(&MyProc->backendLock);
+ LWLockRelease(&MyProc->fpInfoLock);
/* Lock may have already been transferred by some other backend. */
if (proclock == NULL)
if (proc == MyProc)
continue;
- LWLockAcquire(&proc->backendLock, LW_SHARED);
+ LWLockAcquire(&proc->fpInfoLock, LW_SHARED);
/*
* If the target backend isn't referencing the same database as
*/
if (proc->databaseId != locktag->locktag_field1)
{
- LWLockRelease(&proc->backendLock);
+ LWLockRelease(&proc->fpInfoLock);
continue;
}
break;
}
- LWLockRelease(&proc->backendLock);
+ LWLockRelease(&proc->fpInfoLock);
}
}
PGPROC *proc = &ProcGlobal->allProcs[i];
uint32 f;
- LWLockAcquire(&proc->backendLock, LW_SHARED);
+ LWLockAcquire(&proc->fpInfoLock, LW_SHARED);
for (f = 0; f < FP_LOCK_SLOTS_PER_BACKEND; ++f)
{
el++;
}
- LWLockRelease(&proc->backendLock);
+ LWLockRelease(&proc->fpInfoLock);
}
/*
* as MyProc->lxid, you might wonder if we really need both. The
* difference is that MyProc->lxid is set and cleared unlocked, and
* examined by procarray.c, while fpLocalTransactionId is protected by
- * backendLock and is used only by the locking subsystem. Doing it this
+ * fpInfoLock and is used only by the locking subsystem. Doing it this
* way makes it easier to verify that there are no funny race conditions.
*
* We don't bother recording this lock in the local lock table, since it's
{
Assert(VirtualTransactionIdIsValid(vxid));
- LWLockAcquire(&MyProc->backendLock, LW_EXCLUSIVE);
+ LWLockAcquire(&MyProc->fpInfoLock, LW_EXCLUSIVE);
Assert(MyProc->backendId == vxid.backendId);
Assert(MyProc->fpLocalTransactionId == InvalidLocalTransactionId);
MyProc->fpVXIDLock = true;
MyProc->fpLocalTransactionId = vxid.localTransactionId;
- LWLockRelease(&MyProc->backendLock);
+ LWLockRelease(&MyProc->fpInfoLock);
}
/*
/*
* Clean up shared memory state.
*/
- LWLockAcquire(&MyProc->backendLock, LW_EXCLUSIVE);
+ LWLockAcquire(&MyProc->fpInfoLock, LW_EXCLUSIVE);
fastpath = MyProc->fpVXIDLock;
lxid = MyProc->fpLocalTransactionId;
MyProc->fpVXIDLock = false;
MyProc->fpLocalTransactionId = InvalidLocalTransactionId;
- LWLockRelease(&MyProc->backendLock);
+ LWLockRelease(&MyProc->fpInfoLock);
/*
* If fpVXIDLock has been cleared without touching fpLocalTransactionId,
* against the ones we're waiting for. The target backend will only set
* or clear lxid while holding this lock.
*/
- LWLockAcquire(&proc->backendLock, LW_EXCLUSIVE);
+ LWLockAcquire(&proc->fpInfoLock, LW_EXCLUSIVE);
/* If the transaction has ended, our work here is done. */
if (proc->backendId != vxid.backendId
|| proc->fpLocalTransactionId != vxid.localTransactionId)
{
- LWLockRelease(&proc->backendLock);
+ LWLockRelease(&proc->fpInfoLock);
return true;
}
*/
if (!wait)
{
- LWLockRelease(&proc->backendLock);
+ LWLockRelease(&proc->fpInfoLock);
return false;
}
if (!proclock)
{
LWLockRelease(partitionLock);
- LWLockRelease(&proc->backendLock);
+ LWLockRelease(&proc->fpInfoLock);
ereport(ERROR,
(errcode(ERRCODE_OUT_OF_MEMORY),
errmsg("out of shared memory"),
}
/* Done with proc->fpLockBits */
- LWLockRelease(&proc->backendLock);
+ LWLockRelease(&proc->fpInfoLock);
/* Time to wait. */
(void) LockAcquire(&tag, ShareLock, false, false);
* 3. Extensions can create new tranches, via either RequestNamedLWLockTranche
* or LWLockRegisterTranche. The names of these that are known in the current
* process appear in LWLockTrancheNames[].
+ *
+ * All these names are user-visible as wait event names, so choose with care
+ * ... and do not forget to update the documentation's list of wait events.
*/
static const char *const BuiltinTrancheNames[] = {
/* LWTRANCHE_SERIAL_BUFFER: */
"SerialBuffer",
/* LWTRANCHE_WAL_INSERT: */
- "wal_insert",
+ "WALInsert",
/* LWTRANCHE_BUFFER_CONTENT: */
- "buffer_content",
- /* LWTRANCHE_BUFFER_IO_IN_PROGRESS: */
- "buffer_io",
- /* LWTRANCHE_REPLICATION_ORIGIN: */
- "replication_origin",
- /* LWTRANCHE_REPLICATION_SLOT_IO_IN_PROGRESS: */
- "replication_slot_io",
- /* LWTRANCHE_PROC: */
- "proc",
+ "BufferContent",
+ /* LWTRANCHE_BUFFER_IO: */
+ "BufferIO",
+ /* LWTRANCHE_REPLICATION_ORIGIN_STATE: */
+ "ReplicationOriginState",
+ /* LWTRANCHE_REPLICATION_SLOT_IO: */
+ "ReplicationSlotIO",
+ /* LWTRANCHE_LOCK_FASTPATH: */
+ "LockFastPath",
/* LWTRANCHE_BUFFER_MAPPING: */
- "buffer_mapping",
+ "BufferMapping",
/* LWTRANCHE_LOCK_MANAGER: */
- "lock_manager",
+ "LockManager",
/* LWTRANCHE_PREDICATE_LOCK_MANAGER: */
- "predicate_lock_manager",
+ "PredicateLockManager",
/* LWTRANCHE_PARALLEL_HASH_JOIN: */
- "parallel_hash_join",
+ "ParallelHashJoin",
/* LWTRANCHE_PARALLEL_QUERY_DSA: */
- "parallel_query_dsa",
- /* LWTRANCHE_SESSION_DSA: */
- "session_dsa",
- /* LWTRANCHE_SESSION_RECORD_TABLE: */
- "session_record_table",
- /* LWTRANCHE_SESSION_TYPMOD_TABLE: */
- "session_typmod_table",
+ "ParallelQueryDSA",
+ /* LWTRANCHE_PER_SESSION_DSA: */
+ "PerSessionDSA",
+ /* LWTRANCHE_PER_SESSION_RECORD_TYPE: */
+ "PerSessionRecordType",
+ /* LWTRANCHE_PER_SESSION_RECORD_TYPMOD: */
+ "PerSessionRecordTypmod",
/* LWTRANCHE_SHARED_TUPLESTORE: */
- "shared_tuplestore",
- /* LWTRANCHE_TBM: */
- "tbm",
+ "SharedTupleStore",
+ /* LWTRANCHE_SHARED_TIDBITMAP: */
+ "SharedTidBitmap",
/* LWTRANCHE_PARALLEL_APPEND: */
- "parallel_append",
- /* LWTRANCHE_SXACT: */
- "serializable_xact"
+ "ParallelAppend",
+ /* LWTRANCHE_PER_XACT_PREDICATE_LIST: */
+ "PerXactPredicateList"
};
StaticAssertDecl(lengthof(BuiltinTrancheNames) ==
*
* This routine will save a pointer to the tranche name passed as an argument,
* so the name should be allocated in a backend-lifetime context
- * (TopMemoryContext, static constant, or similar).
+ * (shared memory, TopMemoryContext, static constant, or similar).
+ *
+ * The tranche name will be user-visible as a wait event name, so try to
+ * use a name that fits the style for those.
*/
void
LWLockRegisterTranche(int tranche_id, const char *tranche_name)
* will be ignored. (We could raise an error, but it seems better to make
* it a no-op, so that libraries containing such calls can be reloaded if
* needed.)
+ *
+ * The tranche name will be user-visible as a wait event name, so try to
+ * use a name that fits the style for those.
*/
void
RequestNamedLWLockTranche(const char *tranche_name, int num_lwlocks)
# these are defined here. If you add a lock, add it to the end to avoid
# renumbering the existing locks; if you remove a lock, consider leaving a gap
# in the numbering sequence for the benefit of DTrace and other external
-# debugging scripts.
+# debugging scripts. Also, do not forget to update the list of wait events
+# in the user documentation.
# 0 is available; was formerly BufFreelistLock
ShmemIndexLock 1
NotifyQueueLock 27
SerializableXactHashLock 28
SerializableFinishedListLock 29
-SerializablePredicateLockListLock 30
+SerializablePredicateListLock 30
SerialSLRULock 31
SyncRepLock 32
BackgroundWorkerLock 33
* - Protects the list of transactions which have completed but which
* may yet matter because they overlap still-active transactions.
*
- * SerializablePredicateLockListLock
+ * SerializablePredicateListLock
* - Protects the linked list of locks held by a transaction. Note
* that the locks themselves are also covered by the partition
* locks of their respective lock targets; this lock only affects
* than its own active transaction must acquire an exclusive
* lock.
*
- * SERIALIZABLEXACT's member 'predicateLockListLock'
- * - Protects the linked list of locks held by a transaction. Only
- * needed for parallel mode, where multiple backends share the
+ * SERIALIZABLEXACT's member 'perXactPredicateListLock'
+ * - Protects the linked list of predicate locks held by a transaction.
+ * Only needed for parallel mode, where multiple backends share the
* same SERIALIZABLEXACT object. Not needed if
- * SerializablePredicateLockListLock is held exclusively.
+ * SerializablePredicateListLock is held exclusively.
*
* PredicateLockHashPartitionLock(hashcode)
* - The same lock protects a target, all locks on that target, and
memset(PredXact->element, 0, requestSize);
for (i = 0; i < max_table_size; i++)
{
- LWLockInitialize(&PredXact->element[i].sxact.predicateLockListLock,
- LWTRANCHE_SXACT);
+ LWLockInitialize(&PredXact->element[i].sxact.perXactPredicateListLock,
+ LWTRANCHE_PER_XACT_PREDICATE_LIST);
SHMQueueInsertBefore(&(PredXact->availableList),
&(PredXact->element[i].link));
}
/*
* Remove the dummy entry from the predicate lock target hash, to free up some
- * scratch space. The caller must be holding SerializablePredicateLockListLock,
+ * scratch space. The caller must be holding SerializablePredicateListLock,
* and must restore the entry with RestoreScratchTarget() before releasing the
* lock.
*
{
bool found;
- Assert(LWLockHeldByMe(SerializablePredicateLockListLock));
+ Assert(LWLockHeldByMe(SerializablePredicateListLock));
if (!lockheld)
LWLockAcquire(ScratchPartitionLock, LW_EXCLUSIVE);
{
bool found;
- Assert(LWLockHeldByMe(SerializablePredicateLockListLock));
+ Assert(LWLockHeldByMe(SerializablePredicateListLock));
if (!lockheld)
LWLockAcquire(ScratchPartitionLock, LW_EXCLUSIVE);
{
PREDICATELOCKTARGET *rmtarget PG_USED_FOR_ASSERTS_ONLY;
- Assert(LWLockHeldByMe(SerializablePredicateLockListLock));
+ Assert(LWLockHeldByMe(SerializablePredicateListLock));
/* Can't remove it until no locks at this target. */
if (!SHMQueueEmpty(&target->predicateLocks))
SERIALIZABLEXACT *sxact;
PREDICATELOCK *predlock;
- LWLockAcquire(SerializablePredicateLockListLock, LW_SHARED);
+ LWLockAcquire(SerializablePredicateListLock, LW_SHARED);
sxact = MySerializableXact;
if (IsInParallelMode())
- LWLockAcquire(&sxact->predicateLockListLock, LW_EXCLUSIVE);
+ LWLockAcquire(&sxact->perXactPredicateListLock, LW_EXCLUSIVE);
predlock = (PREDICATELOCK *)
SHMQueueNext(&(sxact->predicateLocks),
&(sxact->predicateLocks),
predlock = nextpredlock;
}
if (IsInParallelMode())
- LWLockRelease(&sxact->predicateLockListLock);
- LWLockRelease(SerializablePredicateLockListLock);
+ LWLockRelease(&sxact->perXactPredicateListLock);
+ LWLockRelease(SerializablePredicateListLock);
}
/*
partitionLock = PredicateLockHashPartitionLock(targettaghash);
- LWLockAcquire(SerializablePredicateLockListLock, LW_SHARED);
+ LWLockAcquire(SerializablePredicateListLock, LW_SHARED);
if (IsInParallelMode())
- LWLockAcquire(&sxact->predicateLockListLock, LW_EXCLUSIVE);
+ LWLockAcquire(&sxact->perXactPredicateListLock, LW_EXCLUSIVE);
LWLockAcquire(partitionLock, LW_EXCLUSIVE);
/* Make sure that the target is represented. */
LWLockRelease(partitionLock);
if (IsInParallelMode())
- LWLockRelease(&sxact->predicateLockListLock);
- LWLockRelease(SerializablePredicateLockListLock);
+ LWLockRelease(&sxact->perXactPredicateListLock);
+ LWLockRelease(SerializablePredicateListLock);
}
/*
*
* Remove a predicate lock target along with any locks held for it.
*
- * Caller must hold SerializablePredicateLockListLock and the
+ * Caller must hold SerializablePredicateListLock and the
* appropriate hash partition lock for the target.
*/
static void
PREDICATELOCK *nextpredlock;
bool found;
- Assert(LWLockHeldByMeInMode(SerializablePredicateLockListLock,
+ Assert(LWLockHeldByMeInMode(SerializablePredicateListLock,
LW_EXCLUSIVE));
Assert(LWLockHeldByMe(PredicateLockHashPartitionLock(targettaghash)));
* covers it, or if we are absolutely certain that no one will need to
* refer to that lock in the future.
*
- * Caller must hold SerializablePredicateLockListLock exclusively.
+ * Caller must hold SerializablePredicateListLock exclusively.
*/
static bool
TransferPredicateLocksToNewTarget(PREDICATELOCKTARGETTAG oldtargettag,
bool found;
bool outOfShmem = false;
- Assert(LWLockHeldByMeInMode(SerializablePredicateLockListLock,
+ Assert(LWLockHeldByMeInMode(SerializablePredicateListLock,
LW_EXCLUSIVE));
oldtargettaghash = PredicateLockTargetTagHashCode(&oldtargettag);
heaptarget = NULL;
/* Acquire locks on all lock partitions */
- LWLockAcquire(SerializablePredicateLockListLock, LW_EXCLUSIVE);
+ LWLockAcquire(SerializablePredicateListLock, LW_EXCLUSIVE);
for (i = 0; i < NUM_PREDICATELOCK_PARTITIONS; i++)
LWLockAcquire(PredicateLockHashPartitionLockByIndex(i), LW_EXCLUSIVE);
LWLockAcquire(SerializableXactHashLock, LW_EXCLUSIVE);
LWLockRelease(SerializableXactHashLock);
for (i = NUM_PREDICATELOCK_PARTITIONS - 1; i >= 0; i--)
LWLockRelease(PredicateLockHashPartitionLockByIndex(i));
- LWLockRelease(SerializablePredicateLockListLock);
+ LWLockRelease(SerializablePredicateListLock);
}
/*
relation->rd_id,
newblkno);
- LWLockAcquire(SerializablePredicateLockListLock, LW_EXCLUSIVE);
+ LWLockAcquire(SerializablePredicateListLock, LW_EXCLUSIVE);
/*
* Try copying the locks over to the new page's tag, creating it if
Assert(success);
}
- LWLockRelease(SerializablePredicateLockListLock);
+ LWLockRelease(SerializablePredicateListLock);
}
/*
/*
* Loop through predicate locks on dummy transaction for summarized data.
*/
- LWLockAcquire(SerializablePredicateLockListLock, LW_SHARED);
+ LWLockAcquire(SerializablePredicateListLock, LW_SHARED);
predlock = (PREDICATELOCK *)
SHMQueueNext(&OldCommittedSxact->predicateLocks,
&OldCommittedSxact->predicateLocks,
predlock = nextpredlock;
}
- LWLockRelease(SerializablePredicateLockListLock);
+ LWLockRelease(SerializablePredicateListLock);
LWLockRelease(SerializableFinishedListLock);
}
* First release all the predicate locks held by this xact (or transfer
* them to OldCommittedSxact if summarize is true)
*/
- LWLockAcquire(SerializablePredicateLockListLock, LW_SHARED);
+ LWLockAcquire(SerializablePredicateListLock, LW_SHARED);
if (IsInParallelMode())
- LWLockAcquire(&sxact->predicateLockListLock, LW_EXCLUSIVE);
+ LWLockAcquire(&sxact->perXactPredicateListLock, LW_EXCLUSIVE);
predlock = (PREDICATELOCK *)
SHMQueueNext(&(sxact->predicateLocks),
&(sxact->predicateLocks),
SHMQueueInit(&sxact->predicateLocks);
if (IsInParallelMode())
- LWLockRelease(&sxact->predicateLockListLock);
- LWLockRelease(SerializablePredicateLockListLock);
+ LWLockRelease(&sxact->perXactPredicateListLock);
+ LWLockRelease(SerializablePredicateListLock);
sxidtag.xid = sxact->topXid;
LWLockAcquire(SerializableXactHashLock, LW_EXCLUSIVE);
uint32 predlockhashcode;
PREDICATELOCK *rmpredlock;
- LWLockAcquire(SerializablePredicateLockListLock, LW_SHARED);
+ LWLockAcquire(SerializablePredicateListLock, LW_SHARED);
if (IsInParallelMode())
- LWLockAcquire(&MySerializableXact->predicateLockListLock, LW_EXCLUSIVE);
+ LWLockAcquire(&MySerializableXact->perXactPredicateListLock, LW_EXCLUSIVE);
LWLockAcquire(partitionLock, LW_EXCLUSIVE);
LWLockAcquire(SerializableXactHashLock, LW_EXCLUSIVE);
LWLockRelease(SerializableXactHashLock);
LWLockRelease(partitionLock);
if (IsInParallelMode())
- LWLockRelease(&MySerializableXact->predicateLockListLock);
- LWLockRelease(SerializablePredicateLockListLock);
+ LWLockRelease(&MySerializableXact->perXactPredicateListLock);
+ LWLockRelease(SerializablePredicateListLock);
if (rmpredlock != NULL)
{
dbId = relation->rd_node.dbNode;
heapId = relation->rd_id;
- LWLockAcquire(SerializablePredicateLockListLock, LW_EXCLUSIVE);
+ LWLockAcquire(SerializablePredicateListLock, LW_EXCLUSIVE);
for (i = 0; i < NUM_PREDICATELOCK_PARTITIONS; i++)
LWLockAcquire(PredicateLockHashPartitionLockByIndex(i), LW_SHARED);
LWLockAcquire(SerializableXactHashLock, LW_EXCLUSIVE);
LWLockRelease(SerializableXactHashLock);
for (i = NUM_PREDICATELOCK_PARTITIONS - 1; i >= 0; i--)
LWLockRelease(PredicateLockHashPartitionLockByIndex(i));
- LWLockRelease(SerializablePredicateLockListLock);
+ LWLockRelease(SerializablePredicateListLock);
}
* than using the local predicate lock table because the latter is not
* guaranteed to be accurate.
*/
- LWLockAcquire(SerializablePredicateLockListLock, LW_SHARED);
+ LWLockAcquire(SerializablePredicateListLock, LW_SHARED);
/*
- * No need to take sxact->predicateLockListLock in parallel mode because
- * there cannot be any parallel workers running while we are preparing a
- * transaction.
+ * No need to take sxact->perXactPredicateListLock in parallel mode
+ * because there cannot be any parallel workers running while we are
+ * preparing a transaction.
*/
Assert(!IsParallelWorker() && !ParallelContextActive());
offsetof(PREDICATELOCK, xactLink));
}
- LWLockRelease(SerializablePredicateLockListLock);
+ LWLockRelease(SerializablePredicateListLock);
}
/*
/* Common initialization for all PGPROCs, regardless of type. */
/*
- * Set up per-PGPROC semaphore, latch, and backendLock. Prepared xact
+ * Set up per-PGPROC semaphore, latch, and fpInfoLock. Prepared xact
* dummy PGPROCs don't need these though - they're never associated
* with a real process
*/
{
procs[i].sem = PGSemaphoreCreate();
InitSharedLatch(&(procs[i].procLatch));
- LWLockInitialize(&(procs[i].backendLock), LWTRANCHE_PROC);
+ LWLockInitialize(&(procs[i].fpInfoLock), LWTRANCHE_LOCK_FASTPATH);
}
procs[i].pgprocno = i;
sizeof(SharedRecordTableEntry),
shared_record_table_compare,
shared_record_table_hash,
- LWTRANCHE_SESSION_RECORD_TABLE
+ LWTRANCHE_PER_SESSION_RECORD_TYPE
};
/* Parameters for SharedRecordTypmodRegistry's typmod hash table. */
sizeof(SharedTypmodTableEntry),
dshash_memcmp,
dshash_memhash,
- LWTRANCHE_SESSION_TYPMOD_TABLE
+ LWTRANCHE_PER_SESSION_RECORD_TYPMOD
};
/* hashtable for recognizing registered record types */
LWTRANCHE_SERIAL_BUFFER,
LWTRANCHE_WAL_INSERT,
LWTRANCHE_BUFFER_CONTENT,
- LWTRANCHE_BUFFER_IO_IN_PROGRESS,
- LWTRANCHE_REPLICATION_ORIGIN,
- LWTRANCHE_REPLICATION_SLOT_IO_IN_PROGRESS,
- LWTRANCHE_PROC,
+ LWTRANCHE_BUFFER_IO,
+ LWTRANCHE_REPLICATION_ORIGIN_STATE,
+ LWTRANCHE_REPLICATION_SLOT_IO,
+ LWTRANCHE_LOCK_FASTPATH,
LWTRANCHE_BUFFER_MAPPING,
LWTRANCHE_LOCK_MANAGER,
LWTRANCHE_PREDICATE_LOCK_MANAGER,
LWTRANCHE_PARALLEL_HASH_JOIN,
LWTRANCHE_PARALLEL_QUERY_DSA,
- LWTRANCHE_SESSION_DSA,
- LWTRANCHE_SESSION_RECORD_TABLE,
- LWTRANCHE_SESSION_TYPMOD_TABLE,
+ LWTRANCHE_PER_SESSION_DSA,
+ LWTRANCHE_PER_SESSION_RECORD_TYPE,
+ LWTRANCHE_PER_SESSION_RECORD_TYPMOD,
LWTRANCHE_SHARED_TUPLESTORE,
- LWTRANCHE_TBM,
+ LWTRANCHE_SHARED_TIDBITMAP,
LWTRANCHE_PARALLEL_APPEND,
- LWTRANCHE_SXACT,
+ LWTRANCHE_PER_XACT_PREDICATE_LIST,
LWTRANCHE_FIRST_USER_DEFINED
} BuiltinTrancheIds;
SHM_QUEUE finishedLink; /* list link in
* FinishedSerializableTransactions */
- LWLock predicateLockListLock; /* protects predicateLocks in parallel
- * mode */
+ /*
+ * perXactPredicateListLock is only used in parallel queries: it protects
+ * this SERIALIZABLEXACT's predicate lock list against other workers of
+ * the same session.
+ */
+ LWLock perXactPredicateListLock;
/*
* for r/o transactions: list of concurrent r/w transactions that we could
XLogRecPtr clogGroupMemberLsn; /* WAL location of commit record for clog
* group member */
- /* Per-backend LWLock. Protects fields below (but not group fields). */
- LWLock backendLock;
-
/* Lock manager data, recording fast-path locks taken by this backend. */
+ LWLock fpInfoLock; /* protects per-backend fast-path state */
uint64 fpLockBits; /* lock modes held for each fast-path slot */
Oid fpRelId[FP_LOCK_SLOTS_PER_BACKEND]; /* slots for rel oids */
bool fpVXIDLock; /* are we holding a fast-path VXID lock? */