summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin Grittner <kgrittn@postgresql.org>2014-06-19 08:51:54 -0500
committerKevin Grittner <kgrittn@postgresql.org>2014-06-19 08:52:16 -0500
commit909cab83058b12cabec6fb10c945f67ef09de5ec (patch)
tree1c5a63abc9d5cdfd1f675a714b3aa92b8b3f8cd2
parentfc5cf383d9ae894e3c9e94701ce5dc468d334433 (diff)
Fix calculation of PREDICATELOCK_MANAGER_LWLOCK_OFFSET.
Commit ea9df812d8502fff74e7bc37d61bdc7d66d77a7f 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.
-rw-r--r--src/include/storage/lwlock.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/include/storage/lwlock.h b/src/include/storage/lwlock.h
index 175fae3a88b..d588b1434e2 100644
--- a/src/include/storage/lwlock.h
+++ b/src/include/storage/lwlock.h
@@ -151,7 +151,7 @@ extern PGDLLIMPORT LWLockPadded *MainLWLockArray;
#define LOCK_MANAGER_LWLOCK_OFFSET \
(BUFFER_MAPPING_LWLOCK_OFFSET + NUM_BUFFER_PARTITIONS)
#define PREDICATELOCK_MANAGER_LWLOCK_OFFSET \
- (NUM_INDIVIDUAL_LWLOCKS + NUM_LOCK_PARTITIONS)
+ (LOCK_MANAGER_LWLOCK_OFFSET + NUM_LOCK_PARTITIONS)
#define NUM_FIXED_LWLOCKS \
(PREDICATELOCK_MANAGER_LWLOCK_OFFSET + NUM_PREDICATELOCK_PARTITIONS)