Skip to content

Commit 56dcbf7

Browse files
committed
Fix allocation for locks
1 parent 52b4cd9 commit 56dcbf7

File tree

1 file changed

+17
-15
lines changed
  • src/backend/storage/lmgr

1 file changed

+17
-15
lines changed

src/backend/storage/lmgr/lock.c

+17-15
Original file line numberDiff line numberDiff line change
@@ -57,21 +57,6 @@ int max_locks_per_xact; /* set by guc.c */
5757
#define NLOCKENTS() \
5858
mul_size(max_locks_per_xact, add_size(MaxBackends, max_prepared_xacts))
5959

60-
/* Lock names. For monitoring purposes */
61-
const char *LOCK_NAMES[] =
62-
{
63-
"Relation",
64-
"RelationExtend",
65-
"Page",
66-
"Tuple",
67-
"Transaction",
68-
"VirtualTransaction",
69-
"SpeculativeToken",
70-
"Object",
71-
"Userlock",
72-
"Advisory"
73-
};
74-
7560
/*
7661
* Data structures defining the semantics of the standard lock methods.
7762
*
@@ -119,6 +104,20 @@ static const LOCKMASK LockConflicts[] = {
119104

120105
};
121106

107+
/* Lock names. For monitoring purposes */
108+
const char *LOCK_NAMES[] =
109+
{
110+
"Relation",
111+
"RelationExtend",
112+
"Page",
113+
"Tuple",
114+
"Transaction",
115+
"VirtualTransaction",
116+
"Object",
117+
"Userlock",
118+
"Advisory"
119+
};
120+
122121
/* Names of lock modes, for debug printouts */
123122
static const char *const lock_mode_names[] =
124123
{
@@ -3314,6 +3313,9 @@ LockShmemSize(void)
33143313
max_table_size *= 2;
33153314
size = add_size(size, hash_estimate_size(max_table_size, sizeof(PROCLOCK)));
33163315

3316+
/* Lock Manager LWLock structures */
3317+
size = add_size(size, LWLockTrancheShmemSize(NUM_LOCK_PARTITIONS));
3318+
33173319
/*
33183320
* Since NLOCKENTS is only an estimate, add 10% safety margin.
33193321
*/

0 commit comments

Comments
 (0)