Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit bfaa8c6

Browse files
committed
Fix calculation of PREDICATELOCK_MANAGER_LWLOCK_OFFSET.
Commit ea9df81 failed to include NUM_BUFFER_PARTITIONS in this offset, resulting in a bad offset. Ultimately this threw off NUM_FIXED_LWLOCKS which is based on earlier offsets, leading to memory allocation problems. It seems likely to have also caused increased LWLOCK contention when serializable transactions were used, because lightweight locks used for that overlapped others. Reported by Amit Kapila with analysis and fix. Backpatch to 9.4, where the bug was introduced.
1 parent 9ba78fb commit bfaa8c6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/include/storage/lwlock.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ extern PGDLLIMPORT LWLockPadded *MainLWLockArray;
151151
#define LOCK_MANAGER_LWLOCK_OFFSET \
152152
(BUFFER_MAPPING_LWLOCK_OFFSET + NUM_BUFFER_PARTITIONS)
153153
#define PREDICATELOCK_MANAGER_LWLOCK_OFFSET \
154-
(NUM_INDIVIDUAL_LWLOCKS + NUM_LOCK_PARTITIONS)
154+
(LOCK_MANAGER_LWLOCK_OFFSET + NUM_LOCK_PARTITIONS)
155155
#define NUM_FIXED_LWLOCKS \
156156
(PREDICATELOCK_MANAGER_LWLOCK_OFFSET + NUM_PREDICATELOCK_PARTITIONS)
157157

0 commit comments

Comments
 (0)