From 036bb15872fa52f6f403ca22d36a8652bbaf9d3c Mon Sep 17 00:00:00 2001 From: Heikki Linnakangas Date: Wed, 9 Feb 2011 12:15:08 +0200 Subject: [PATCH] Fix allocation of RW-conflict pool in the new predicate lock manager, and also take the RW-conflict pool into account in the PredicateLockShmemSize() estimate. --- src/backend/storage/lmgr/predicate.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/backend/storage/lmgr/predicate.c b/src/backend/storage/lmgr/predicate.c index b66fd8678c..722d0f86be 100644 --- a/src/backend/storage/lmgr/predicate.c +++ b/src/backend/storage/lmgr/predicate.c @@ -1119,7 +1119,7 @@ InitPredicateLocks(void) SHMQueueInit(&RWConflictPool->availableList); requestSize = mul_size((Size) max_table_size, - PredXactListElementDataSize); + RWConflictDataSize); RWConflictPool->element = ShmemAlloc(requestSize); if (RWConflictPool->element == NULL) ereport(ERROR, @@ -1190,11 +1190,17 @@ PredicateLockShmemSize(void) size = add_size(size, hash_estimate_size(max_table_size, sizeof(SERIALIZABLEXID))); + /* rw-conflict pool */ + max_table_size *= 5; + size = add_size(size, RWConflictPoolHeaderDataSize); + size = add_size(size, mul_size((Size) max_table_size, + RWConflictDataSize)); + /* Head for list of finished serializable transactions. */ size = add_size(size, sizeof(SHM_QUEUE)); /* Shared memory structures for SLRU tracking of old committed xids. */ - size = add_size(size, sizeof(OldSerXidControl)); + size = add_size(size, sizeof(OldSerXidControlData)); size = add_size(size, SimpleLruShmemSize(NUM_OLDSERXID_BUFFERS, 0)); return size; -- GitLab