Commit 036bb158 authored by Heikki Linnakangas's avatar Heikki Linnakangas

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.
parent 3144c33a
...@@ -1119,7 +1119,7 @@ InitPredicateLocks(void) ...@@ -1119,7 +1119,7 @@ InitPredicateLocks(void)
SHMQueueInit(&RWConflictPool->availableList); SHMQueueInit(&RWConflictPool->availableList);
requestSize = mul_size((Size) max_table_size, requestSize = mul_size((Size) max_table_size,
PredXactListElementDataSize); RWConflictDataSize);
RWConflictPool->element = ShmemAlloc(requestSize); RWConflictPool->element = ShmemAlloc(requestSize);
if (RWConflictPool->element == NULL) if (RWConflictPool->element == NULL)
ereport(ERROR, ereport(ERROR,
...@@ -1190,11 +1190,17 @@ PredicateLockShmemSize(void) ...@@ -1190,11 +1190,17 @@ PredicateLockShmemSize(void)
size = add_size(size, hash_estimate_size(max_table_size, size = add_size(size, hash_estimate_size(max_table_size,
sizeof(SERIALIZABLEXID))); 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. */ /* Head for list of finished serializable transactions. */
size = add_size(size, sizeof(SHM_QUEUE)); size = add_size(size, sizeof(SHM_QUEUE));
/* Shared memory structures for SLRU tracking of old committed xids. */ /* 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)); size = add_size(size, SimpleLruShmemSize(NUM_OLDSERXID_BUFFERS, 0));
return size; return size;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment