PostgreSQL Source Code git master
Loading...
Searching...
No Matches
lock.h
Go to the documentation of this file.
1/*-------------------------------------------------------------------------
2 *
3 * lock.h
4 * POSTGRES low-level lock mechanism
5 *
6 *
7 * Portions Copyright (c) 1996-2026, PostgreSQL Global Development Group
8 * Portions Copyright (c) 1994, Regents of the University of California
9 *
10 * src/include/storage/lock.h
11 *
12 *-------------------------------------------------------------------------
13 */
14#ifndef LOCK_H_
15#define LOCK_H_
16
17#ifdef FRONTEND
18#error "lock.h may not be included from frontend code"
19#endif
20
21#include "access/transam.h"
22#include "lib/ilist.h"
23#include "storage/lockdefs.h"
24#include "storage/locktag.h"
25#include "storage/lwlock.h"
26#include "storage/procnumber.h"
27#include "storage/shmem.h"
28#include "utils/timestamp.h"
29
30/* struct PGPROC is declared in proc.h, but must forward-reference it */
31typedef struct PGPROC PGPROC;
32
33/* GUC variables */
36
37#ifdef LOCK_DEBUG
39extern PGDLLIMPORT bool Trace_locks;
43#endif /* LOCK_DEBUG */
44
45
46/*
47 * Top-level transactions are identified by VirtualTransactionIDs comprising
48 * PGPROC fields procNumber and lxid. For recovered prepared transactions, the
49 * LocalTransactionId is an ordinary XID; LOCKTAG_VIRTUALTRANSACTION never
50 * refers to that kind. These are guaranteed unique over the short term, but
51 * will be reused after a database restart or XID wraparound; hence they
52 * should never be stored on disk.
53 *
54 * Note that struct VirtualTransactionId can not be assumed to be atomically
55 * assignable as a whole. However, type LocalTransactionId is assumed to
56 * be atomically assignable, and the proc number doesn't change often enough
57 * to be a problem, so we can fetch or assign the two fields separately.
58 * We deliberately refrain from using the struct within PGPROC, to prevent
59 * coding errors from trying to use struct assignment with it; instead use
60 * GET_VXID_FROM_PGPROC().
61 */
62typedef struct
63{
64 ProcNumber procNumber; /* proc number of the PGPROC */
65 LocalTransactionId localTransactionId; /* lxid from PGPROC */
67
68#define InvalidLocalTransactionId 0
69#define LocalTransactionIdIsValid(lxid) ((lxid) != InvalidLocalTransactionId)
70#define VirtualTransactionIdIsValid(vxid) \
71 (LocalTransactionIdIsValid((vxid).localTransactionId))
72#define VirtualTransactionIdIsRecoveredPreparedXact(vxid) \
73 ((vxid).procNumber == INVALID_PROC_NUMBER)
74#define VirtualTransactionIdEquals(vxid1, vxid2) \
75 ((vxid1).procNumber == (vxid2).procNumber && \
76 (vxid1).localTransactionId == (vxid2).localTransactionId)
77#define SetInvalidVirtualTransactionId(vxid) \
78 ((vxid).procNumber = INVALID_PROC_NUMBER, \
79 (vxid).localTransactionId = InvalidLocalTransactionId)
80#define GET_VXID_FROM_PGPROC(vxid_dst, proc) \
81 ((vxid_dst).procNumber = (proc).vxid.procNumber, \
82 (vxid_dst).localTransactionId = (proc).vxid.lxid)
83
84/* MAX_LOCKMODES cannot be larger than the # of bits in LOCKMASK */
85#define MAX_LOCKMODES 10
86
87#define LOCKBIT_ON(lockmode) (1 << (lockmode))
88#define LOCKBIT_OFF(lockmode) (~(1 << (lockmode)))
89
90
91/*
92 * This data structure defines the locking semantics associated with a
93 * "lock method". The semantics specify the meaning of each lock mode
94 * (by defining which lock modes it conflicts with).
95 * All of this data is constant and is kept in const tables.
96 *
97 * numLockModes -- number of lock modes (READ,WRITE,etc) that
98 * are defined in this lock method. Must be less than MAX_LOCKMODES.
99 *
100 * conflictTab -- this is an array of bitmasks showing lock
101 * mode conflicts. conflictTab[i] is a mask with the j-th bit
102 * turned on if lock modes i and j conflict. Lock modes are
103 * numbered 1..numLockModes; conflictTab[0] is unused.
104 *
105 * lockModeNames -- ID strings for debug printouts.
106 *
107 * trace_flag -- pointer to GUC trace flag for this lock method. (The
108 * GUC variable is not constant, but we use "const" here to denote that
109 * it can't be changed through this reference.)
110 */
111typedef struct LockMethodData
112{
115 const char *const *lockModeNames;
116 const bool *trace_flag;
118
120
121/*
122 * Per-locked-object lock information:
123 *
124 * tag -- uniquely identifies the object being locked
125 * grantMask -- bitmask for all lock types currently granted on this object.
126 * waitMask -- bitmask for all lock types currently awaited on this object.
127 * procLocks -- list of PROCLOCK objects for this lock.
128 * waitProcs -- queue of processes waiting for this lock.
129 * requested -- count of each lock type currently requested on the lock
130 * (includes requests already granted!!).
131 * nRequested -- total requested locks of all types.
132 * granted -- count of each lock type currently granted on the lock.
133 * nGranted -- total granted locks of all types.
134 *
135 * Note: these counts count 1 for each backend. Internally to a backend,
136 * there may be multiple grabs on a particular lock, but this is not reflected
137 * into shared memory.
138 */
139typedef struct LOCK
140{
141 /* hash key */
142 LOCKTAG tag; /* unique identifier of lockable object */
143
144 /* data */
145 LOCKMASK grantMask; /* bitmask for lock types already granted */
146 LOCKMASK waitMask; /* bitmask for lock types awaited */
147 dlist_head procLocks; /* list of PROCLOCK objects assoc. with lock */
148 dclist_head waitProcs; /* list of PGPROC objects waiting on lock */
149 int requested[MAX_LOCKMODES]; /* counts of requested locks */
150 int nRequested; /* total of requested[] array */
151 int granted[MAX_LOCKMODES]; /* counts of granted locks */
152 int nGranted; /* total of granted[] array */
154
155#define LOCK_LOCKMETHOD(lock) ((LOCKMETHODID) (lock).tag.locktag_lockmethodid)
156#define LOCK_LOCKTAG(lock) ((LockTagType) (lock).tag.locktag_type)
157
158
159/*
160 * We may have several different backends holding or awaiting locks
161 * on the same lockable object. We need to store some per-holder/waiter
162 * information for each such holder (or would-be holder). This is kept in
163 * a PROCLOCK struct.
164 *
165 * PROCLOCKTAG is the key information needed to look up a PROCLOCK item in the
166 * proclock hashtable. A PROCLOCKTAG value uniquely identifies the combination
167 * of a lockable object and a holder/waiter for that object. (We can use
168 * pointers here because the PROCLOCKTAG need only be unique for the lifespan
169 * of the PROCLOCK, and it will never outlive the lock or the proc.)
170 *
171 * Internally to a backend, it is possible for the same lock to be held
172 * for different purposes: the backend tracks transaction locks separately
173 * from session locks. However, this is not reflected in the shared-memory
174 * state: we only track which backend(s) hold the lock. This is OK since a
175 * backend can never block itself.
176 *
177 * The holdMask field shows the already-granted locks represented by this
178 * proclock. Note that there will be a proclock object, possibly with
179 * zero holdMask, for any lock that the process is currently waiting on.
180 * Otherwise, proclock objects whose holdMasks are zero are recycled
181 * as soon as convenient.
182 *
183 * releaseMask is workspace for LockReleaseAll(): it shows the locks due
184 * to be released during the current call. This must only be examined or
185 * set by the backend owning the PROCLOCK.
186 *
187 * Each PROCLOCK object is linked into lists for both the associated LOCK
188 * object and the owning PGPROC object. Note that the PROCLOCK is entered
189 * into these lists as soon as it is created, even if no lock has yet been
190 * granted. A PGPROC that is waiting for a lock to be granted will also be
191 * linked into the lock's waitProcs queue.
192 */
193typedef struct PROCLOCKTAG
194{
195 /* NB: we assume this struct contains no padding! */
196 LOCK *myLock; /* link to per-lockable-object information */
197 PGPROC *myProc; /* link to PGPROC of owning backend */
199
200typedef struct PROCLOCK
201{
202 /* tag */
203 PROCLOCKTAG tag; /* unique identifier of proclock object */
204
205 /* data */
206 PGPROC *groupLeader; /* proc's lock group leader, or proc itself */
207 LOCKMASK holdMask; /* bitmask for lock types currently held */
208 LOCKMASK releaseMask; /* bitmask for lock types to be released */
209 dlist_node lockLink; /* list link in LOCK's list of proclocks */
210 dlist_node procLink; /* list link in PGPROC's list of proclocks */
212
213#define PROCLOCK_LOCKMETHOD(proclock) \
214 LOCK_LOCKMETHOD(*((proclock).tag.myLock))
215
216/*
217 * Each backend also maintains a local hash table with information about each
218 * lock it is currently interested in. In particular the local table counts
219 * the number of times that lock has been acquired. This allows multiple
220 * requests for the same lock to be executed without additional accesses to
221 * shared memory. We also track the number of lock acquisitions per
222 * ResourceOwner, so that we can release just those locks belonging to a
223 * particular ResourceOwner.
224 *
225 * When holding a lock taken "normally", the lock and proclock fields always
226 * point to the associated objects in shared memory. However, if we acquired
227 * the lock via the fast-path mechanism, the lock and proclock fields are set
228 * to NULL, since there probably aren't any such objects in shared memory.
229 * (If the lock later gets promoted to normal representation, we may eventually
230 * update our locallock's lock/proclock fields after finding the shared
231 * objects.)
232 *
233 * Caution: a locallock object can be left over from a failed lock acquisition
234 * attempt. In this case its lock/proclock fields are untrustworthy, since
235 * the shared lock object is neither held nor awaited, and hence is available
236 * to be reclaimed. If nLocks > 0 then these pointers must either be valid or
237 * NULL, but when nLocks == 0 they should be considered garbage.
238 */
239typedef struct LOCALLOCKTAG
240{
241 LOCKTAG lock; /* identifies the lockable object */
242 LOCKMODE mode; /* lock mode for this table entry */
244
245typedef struct LOCALLOCKOWNER
246{
247 /*
248 * Note: if owner is NULL then the lock is held on behalf of the session;
249 * otherwise it is held on behalf of my current transaction.
250 *
251 * Must use a forward struct reference to avoid circularity.
252 */
254 int64 nLocks; /* # of times held by this owner */
256
257typedef struct LOCALLOCK
258{
259 /* tag */
260 LOCALLOCKTAG tag; /* unique identifier of locallock entry */
261
262 /* data */
263 uint32 hashcode; /* copy of LOCKTAG's hash value */
264 LOCK *lock; /* associated LOCK object, if any */
265 PROCLOCK *proclock; /* associated PROCLOCK object, if any */
266 int64 nLocks; /* total number of times lock is held */
267 int numLockOwners; /* # of relevant ResourceOwners */
268 int maxLockOwners; /* allocated size of array */
269 LOCALLOCKOWNER *lockOwners; /* dynamically resizable array */
270 bool holdsStrongLockCount; /* bumped FastPathStrongRelationLocks */
271 bool lockCleared; /* we read all sinval msgs for lock */
273
274#define LOCALLOCK_LOCKMETHOD(llock) ((llock).tag.lock.locktag_lockmethodid)
275#define LOCALLOCK_LOCKTAG(llock) ((LockTagType) (llock).tag.lock.locktag_type)
276
277
278/*
279 * These structures hold information passed from lmgr internals to the lock
280 * listing user-level functions (in lockfuncs.c).
281 */
282
283typedef struct LockInstanceData
284{
285 LOCKTAG locktag; /* tag for locked object */
286 LOCKMASK holdMask; /* locks held by this PGPROC */
287 LOCKMODE waitLockMode; /* lock awaited by this PGPROC, if any */
288 VirtualTransactionId vxid; /* virtual transaction ID of this PGPROC */
289 TimestampTz waitStart; /* time at which this PGPROC started waiting
290 * for lock */
291 int pid; /* pid of this PGPROC */
292 int leaderPid; /* pid of group leader; = pid if no group */
293 bool fastpath; /* taken via fastpath? */
295
296typedef struct LockData
297{
298 int nelements; /* The length of the array */
299 LockInstanceData *locks; /* Array of per-PROCLOCK information */
301
302typedef struct BlockedProcData
303{
304 int pid; /* pid of a blocked PGPROC */
305 /* Per-PROCLOCK information about PROCLOCKs of the lock the pid awaits */
306 /* (these fields refer to indexes in BlockedProcsData.locks[]) */
307 int first_lock; /* index of first relevant LockInstanceData */
308 int num_locks; /* number of relevant LockInstanceDatas */
309 /* PIDs of PGPROCs that are ahead of "pid" in the lock's wait queue */
310 /* (these fields refer to indexes in BlockedProcsData.waiter_pids[]) */
311 int first_waiter; /* index of first preceding waiter */
312 int num_waiters; /* number of preceding waiters */
314
315typedef struct BlockedProcsData
316{
317 BlockedProcData *procs; /* Array of per-blocked-proc information */
318 LockInstanceData *locks; /* Array of per-PROCLOCK information */
319 int *waiter_pids; /* Array of PIDs of other blocked PGPROCs */
320 int nprocs; /* # of valid entries in procs[] array */
321 int maxprocs; /* Allocated length of procs[] array */
322 int nlocks; /* # of valid entries in locks[] array */
323 int maxlocks; /* Allocated length of locks[] array */
324 int npids; /* # of valid entries in waiter_pids[] array */
325 int maxpids; /* Allocated length of waiter_pids[] array */
327
328
329/* Result codes for LockAcquire() */
330typedef enum
331{
332 LOCKACQUIRE_NOT_AVAIL, /* lock not available, and dontWait=true */
333 LOCKACQUIRE_OK, /* lock successfully acquired */
334 LOCKACQUIRE_ALREADY_HELD, /* incremented count for lock already held */
335 LOCKACQUIRE_ALREADY_CLEAR, /* incremented count for lock already clear */
337
338/* Deadlock states identified by DeadLockCheck() */
339typedef enum
340{
341 DS_NOT_YET_CHECKED, /* no deadlock check has run yet */
342 DS_NO_DEADLOCK, /* no deadlock detected */
343 DS_SOFT_DEADLOCK, /* deadlock avoided by queue rearrangement */
344 DS_HARD_DEADLOCK, /* deadlock, no way out but ERROR */
345 DS_BLOCKED_BY_AUTOVACUUM, /* no deadlock; queue blocked by autovacuum
346 * worker */
348
349/*
350 * The lockmgr's shared hash tables are partitioned to reduce contention.
351 * To determine which partition a given locktag belongs to, compute the tag's
352 * hash code with LockTagHashCode(), then apply one of these macros.
353 * NB: NUM_LOCK_PARTITIONS must be a power of 2!
354 */
355#define LockHashPartition(hashcode) \
356 ((hashcode) % NUM_LOCK_PARTITIONS)
357#define LockHashPartitionLock(hashcode) \
358 (&MainLWLockArray[LOCK_MANAGER_LWLOCK_OFFSET + \
359 LockHashPartition(hashcode)].lock)
360#define LockHashPartitionLockByIndex(i) \
361 (&MainLWLockArray[LOCK_MANAGER_LWLOCK_OFFSET + (i)].lock)
362
363/*
364 * The deadlock detector needs to be able to access lockGroupLeader and
365 * related fields in the PGPROC, so we arrange for those fields to be protected
366 * by one of the lock hash partition locks. Since the deadlock detector
367 * acquires all such locks anyway, this makes it safe for it to access these
368 * fields without doing anything extra. To avoid contention as much as
369 * possible, we map different PGPROCs to different partition locks. The lock
370 * used for a given lock group is determined by the group leader's pgprocno.
371 */
372#define LockHashPartitionLockByProc(leader_pgproc) \
373 LockHashPartitionLock(GetNumberFromPGProc(leader_pgproc))
374
375/*
376 * function prototypes
377 */
378extern void LockManagerShmemInit(void);
379extern Size LockManagerShmemSize(void);
380extern void InitLockManagerAccess(void);
381extern LockMethod GetLocksMethodTable(const LOCK *lock);
382extern LockMethod GetLockTagsMethodTable(const LOCKTAG *locktag);
383extern uint32 LockTagHashCode(const LOCKTAG *locktag);
385extern LockAcquireResult LockAcquire(const LOCKTAG *locktag,
386 LOCKMODE lockmode,
387 bool sessionLock,
388 bool dontWait);
389extern LockAcquireResult LockAcquireExtended(const LOCKTAG *locktag,
390 LOCKMODE lockmode,
391 bool sessionLock,
392 bool dontWait,
395 bool logLockFailure);
396extern void AbortStrongLockAcquire(void);
397extern void MarkLockClear(LOCALLOCK *locallock);
398extern bool LockRelease(const LOCKTAG *locktag,
399 LOCKMODE lockmode, bool sessionLock);
402extern void LockReleaseCurrentOwner(LOCALLOCK **locallocks, int nlocks);
403extern void LockReassignCurrentOwner(LOCALLOCK **locallocks, int nlocks);
404extern bool LockHeldByMe(const LOCKTAG *locktag,
405 LOCKMODE lockmode, bool orstronger);
406#ifdef USE_ASSERT_CHECKING
407extern HTAB *GetLockMethodLocalHash(void);
408#endif
409extern bool LockHasWaiters(const LOCKTAG *locktag,
410 LOCKMODE lockmode, bool sessionLock);
411extern VirtualTransactionId *GetLockConflicts(const LOCKTAG *locktag,
412 LOCKMODE lockmode, int *countp);
413extern void AtPrepare_Locks(void);
414extern void PostPrepare_Locks(FullTransactionId fxid);
416 LOCKMODE lockmode,
417 LOCK *lock, PROCLOCK *proclock);
418extern void GrantLock(LOCK *lock, PROCLOCK *proclock, LOCKMODE lockmode);
419extern void GrantAwaitedLock(void);
420extern LOCALLOCK *GetAwaitedLock(void);
421extern void ResetAwaitedLock(void);
422
423extern void RemoveFromWaitQueue(PGPROC *proc, uint32 hashcode);
424extern LockData *GetLockStatusData(void);
426
429
430extern void lock_twophase_recover(FullTransactionId fxid, uint16 info,
431 void *recdata, uint32 len);
433 void *recdata, uint32 len);
435 void *recdata, uint32 len);
437 void *recdata, uint32 len);
438
441pg_noreturn extern void DeadLockReport(void);
443 LOCKMODE lockmode,
444 LOCK *lock,
445 PGPROC *proc2);
446extern void InitDeadLockChecking(void);
447
448extern int LockWaiterCount(const LOCKTAG *locktag);
449
450#ifdef LOCK_DEBUG
451extern void DumpLocks(PGPROC *proc);
452extern void DumpAllLocks(void);
453#endif
454
455/* Lock a VXID (used to wait for a transaction to finish) */
457extern void VirtualXactLockTableCleanup(void);
458extern bool VirtualXactLock(VirtualTransactionId vxid, bool wait);
459
460#endif /* LOCK_H_ */
#define PGDLLIMPORT
Definition c.h:1423
#define pg_noreturn
Definition c.h:184
int64_t int64
Definition c.h:615
uint16_t uint16
Definition c.h:617
uint32_t uint32
Definition c.h:618
uint32 LocalTransactionId
Definition c.h:740
size_t Size
Definition c.h:691
int64 TimestampTz
Definition timestamp.h:39
LockAcquireResult LockAcquire(const LOCKTAG *locktag, LOCKMODE lockmode, bool sessionLock, bool dontWait)
Definition lock.c:809
bool LockHeldByMe(const LOCKTAG *locktag, LOCKMODE lockmode, bool orstronger)
Definition lock.c:643
PGDLLIMPORT int max_locks_per_xact
Definition lock.c:53
void lock_twophase_postabort(FullTransactionId fxid, uint16 info, void *recdata, uint32 len)
Definition lock.c:4595
void PostPrepare_Locks(FullTransactionId fxid)
Definition lock.c:3572
void lock_twophase_standby_recover(FullTransactionId fxid, uint16 info, void *recdata, uint32 len)
Definition lock.c:4537
bool DoLockModesConflict(LOCKMODE mode1, LOCKMODE mode2)
Definition lock.c:623
PGDLLIMPORT bool log_lock_failures
Definition lock.c:54
const LockMethodData * LockMethod
Definition lock.h:119
void VirtualXactLockTableInsert(VirtualTransactionId vxid)
Definition lock.c:4619
PGPROC * GetBlockingAutoVacuumPgproc(void)
Definition deadlock.c:290
void GrantAwaitedLock(void)
Definition lock.c:1889
int LockWaiterCount(const LOCKTAG *locktag)
Definition lock.c:4853
void AtPrepare_Locks(void)
Definition lock.c:3476
bool LockRelease(const LOCKTAG *locktag, LOCKMODE lockmode, bool sessionLock)
Definition lock.c:2102
Size LockManagerShmemSize(void)
Definition lock.c:3756
void RememberSimpleDeadLock(PGPROC *proc1, LOCKMODE lockmode, LOCK *lock, PGPROC *proc2)
Definition deadlock.c:1147
void InitLockManagerAccess(void)
Definition lock.c:505
void GrantLock(LOCK *lock, PROCLOCK *proclock, LOCKMODE lockmode)
Definition lock.c:1658
void VirtualXactLockTableCleanup(void)
Definition lock.c:4642
bool VirtualXactLock(VirtualTransactionId vxid, bool wait)
Definition lock.c:4742
VirtualTransactionId * GetLockConflicts(const LOCKTAG *locktag, LOCKMODE lockmode, int *countp)
Definition lock.c:3069
void RemoveFromWaitQueue(PGPROC *proc, uint32 hashcode)
Definition lock.c:2046
LockAcquireResult LockAcquireExtended(const LOCKTAG *locktag, LOCKMODE lockmode, bool sessionLock, bool dontWait, bool reportMemoryError, LOCALLOCK **locallockp, bool logLockFailure)
Definition lock.c:836
void LockReleaseAll(LOCKMETHODID lockmethodid, bool allLocks)
Definition lock.c:2307
void ResetAwaitedLock(void)
Definition lock.c:1907
void LockReassignCurrentOwner(LOCALLOCK **locallocks, int nlocks)
Definition lock.c:2706
void AbortStrongLockAcquire(void)
Definition lock.c:1860
DeadLockState
Definition lock.h:340
@ DS_HARD_DEADLOCK
Definition lock.h:344
@ DS_BLOCKED_BY_AUTOVACUUM
Definition lock.h:345
@ DS_NO_DEADLOCK
Definition lock.h:342
@ DS_NOT_YET_CHECKED
Definition lock.h:341
@ DS_SOFT_DEADLOCK
Definition lock.h:343
BlockedProcsData * GetBlockerStatusData(int blocked_pid)
Definition lock.c:3996
#define MAX_LOCKMODES
Definition lock.h:85
void LockManagerShmemInit(void)
Definition lock.c:444
bool LockHasWaiters(const LOCKTAG *locktag, LOCKMODE lockmode, bool sessionLock)
Definition lock.c:696
const char * GetLockmodeName(LOCKMETHODID lockmethodid, LOCKMODE mode)
Definition lock.c:4252
void lock_twophase_postcommit(FullTransactionId fxid, uint16 info, void *recdata, uint32 len)
Definition lock.c:4569
void InitDeadLockChecking(void)
Definition deadlock.c:143
void LockReleaseCurrentOwner(LOCALLOCK **locallocks, int nlocks)
Definition lock.c:2611
LOCALLOCK * GetAwaitedLock(void)
Definition lock.c:1898
void LockReleaseSession(LOCKMETHODID lockmethodid)
Definition lock.c:2581
void MarkLockClear(LOCALLOCK *locallock)
Definition lock.c:1920
LockData * GetLockStatusData(void)
Definition lock.c:3793
DeadLockState DeadLockCheck(PGPROC *proc)
Definition deadlock.c:220
uint32 LockTagHashCode(const LOCKTAG *locktag)
Definition lock.c:557
bool LockCheckConflicts(LockMethod lockMethodTable, LOCKMODE lockmode, LOCK *lock, PROCLOCK *proclock)
Definition lock.c:1529
void lock_twophase_recover(FullTransactionId fxid, uint16 info, void *recdata, uint32 len)
Definition lock.c:4356
pg_noreturn void DeadLockReport(void)
Definition deadlock.c:1075
LockMethod GetLocksMethodTable(const LOCK *lock)
Definition lock.c:527
LockAcquireResult
Definition lock.h:331
@ LOCKACQUIRE_ALREADY_CLEAR
Definition lock.h:335
@ LOCKACQUIRE_OK
Definition lock.h:333
@ LOCKACQUIRE_ALREADY_HELD
Definition lock.h:334
@ LOCKACQUIRE_NOT_AVAIL
Definition lock.h:332
xl_standby_lock * GetRunningTransactionLocks(int *nlocks)
Definition lock.c:4170
LockMethod GetLockTagsMethodTable(const LOCKTAG *locktag)
Definition lock.c:539
int LOCKMODE
Definition lockdefs.h:26
int LOCKMASK
Definition lockdefs.h:25
uint16 LOCKMETHODID
Definition locktag.h:22
static PgChecksumMode mode
const void size_t len
static int fb(int x)
int ProcNumber
Definition procnumber.h:24
int first_lock
Definition lock.h:307
int first_waiter
Definition lock.h:311
int num_waiters
Definition lock.h:312
int num_locks
Definition lock.h:308
LockInstanceData * locks
Definition lock.h:318
int * waiter_pids
Definition lock.h:319
BlockedProcData * procs
Definition lock.h:317
int64 nLocks
Definition lock.h:254
struct ResourceOwnerData * owner
Definition lock.h:253
LOCKTAG lock
Definition lock.h:241
LOCKMODE mode
Definition lock.h:242
LOCALLOCKOWNER * lockOwners
Definition lock.h:269
uint32 hashcode
Definition lock.h:263
int maxLockOwners
Definition lock.h:268
LOCK * lock
Definition lock.h:264
int64 nLocks
Definition lock.h:266
int numLockOwners
Definition lock.h:267
bool holdsStrongLockCount
Definition lock.h:270
PROCLOCK * proclock
Definition lock.h:265
LOCALLOCKTAG tag
Definition lock.h:260
bool lockCleared
Definition lock.h:271
Definition lock.h:140
int nRequested
Definition lock.h:150
LOCKTAG tag
Definition lock.h:142
int requested[MAX_LOCKMODES]
Definition lock.h:149
dclist_head waitProcs
Definition lock.h:148
int granted[MAX_LOCKMODES]
Definition lock.h:151
LOCKMASK grantMask
Definition lock.h:145
LOCKMASK waitMask
Definition lock.h:146
int nGranted
Definition lock.h:152
dlist_head procLocks
Definition lock.h:147
LockInstanceData * locks
Definition lock.h:299
int nelements
Definition lock.h:298
LOCKMASK holdMask
Definition lock.h:286
LOCKMODE waitLockMode
Definition lock.h:287
bool fastpath
Definition lock.h:293
LOCKTAG locktag
Definition lock.h:285
TimestampTz waitStart
Definition lock.h:289
VirtualTransactionId vxid
Definition lock.h:288
const bool * trace_flag
Definition lock.h:116
const LOCKMASK * conflictTab
Definition lock.h:114
const char *const * lockModeNames
Definition lock.h:115
int numLockModes
Definition lock.h:113
Definition proc.h:176
LOCK * myLock
Definition lock.h:196
PGPROC * myProc
Definition lock.h:197
LOCKMASK holdMask
Definition lock.h:207
dlist_node lockLink
Definition lock.h:209
PGPROC * groupLeader
Definition lock.h:206
LOCKMASK releaseMask
Definition lock.h:208
PROCLOCKTAG tag
Definition lock.h:203
dlist_node procLink
Definition lock.h:210
LocalTransactionId localTransactionId
Definition lock.h:65
ProcNumber procNumber
Definition lock.h:64