BufFreelistLock, /* X - all - each time we allocate a new buffer for data block I/O * Never held across I/O */ ShmemIndexLock, /* X - all - create/attach to shared memory * Never held across I/O */ OidGenLock, /* X - all - each GetNewOid() and each GetNewRelFileNode() * S - bgwriter - acquired during checkpoint * Writes WAL record every 8192 OIDs, so vanishing chance * of being held across I/O */ XidGenLock, /* X - all - for each GetNewTransactionId() * check whether we need to call ExtendClog or ExtendSubtrans * could be held across I/O if clog or subtrans buffers * have a dirty LRU page * S - all - for each ReadNewTransactionId() *5 * called by GetNextXidAndEpoch(), * once per VACUUM of each relation * once per start of autovacuum worker * X - all - for each SetTransactionIdLimit() * called after each VACUUM of whole database and * at EOXact if we update catalogs and write relcache file * X - bgwriter - acquired during checkpoint */ ProcArrayLock, /* X - all - adding/removing procs from procarray * backend start or exit, two phase commits *1 * X - all - XidCacheRemoveRunningXids() * S - all - TransactionIdIsInProgress(), TransactionIdIsActive(), * GetOldestXmin(), GetSnapshotData(), GetTransactionsInCommit() * HaveTransactionsInCommit(), BackendPidGetProc(), * BackendXidGetProc(), GetCurrentVirtualXids(), * CountDBBackends(), CountUserBackends(), *2 * CheckOtherDBBackends(), CountActiveBackends() */ SInvalLock, /* X - all - backend startup or exit * X - all - send SInval message * S - all - receive SInval message *3 * X - all - release dead SInval messages */ FreeSpaceLock, /* X - access to the FSM to reuse a block, record freespace * X - held during VACUUM to record free space, maybe rearrange FSM * Never held across I/O, except at database startup/shutdown */ WALInsertLock, /* X - insert data into WAL buffers * Holder may acquire WALWriteLock if WAL buffers full */ WALWriteLock, /* X - any - write WAL buffers to disk - Always held across I/O *4 * S - bgwriter - each loop checks GetLastSegSwitchTime() * Holder conditionally acquiresmay WALInsertLock to perform * piggyback I/O on WAL */ ControlFileLock, /* X - any - must be held to read/write from Control file * Always held across I/O */ CheckpointLock, /* X - bgwriter - must be held to perform CreateCheckpoint * Holder always acquires WALInsertLock, XidGenLock, OidGenLock, * ProcArrayLock and ControlFileLock */ CLogControlLock, SubtransControlLock, MultiXactGenLock, MultiXactOffsetControlLock, MultiXactMemberControlLock, /* SLRU locks */ RelCacheInitLock, BgWriterCommLock, TwoPhaseStateLock, TablespaceCreateLock, BtreeVacuumLock, AddinShmemInitLock, AutovacuumLock, AutovacuumScheduleLock, SyncScanLock, /* X - any - once per large SeqScan, plus conditionally once * per ~16 blocks, during ss_report_location() */ /* Individual lock IDs end here */ FirstBufMappingLock, *6 FirstLockMgrLock = FirstBufMappingLock + NUM_BUFFER_PARTITIONS, /* must be last except for MaxDynamicLWLock: */ NumFixedLWLocks = FirstLockMgrLock + NUM_LOCK_PARTITIONS, MaxDynamicLWLock = 1000000000