]> granicus.if.org Git - postgresql/commitdiff
Fix allocation of RW-conflict pool in the new predicate lock manager, and
authorHeikki Linnakangas <heikki.linnakangas@iki.fi>
Wed, 9 Feb 2011 10:15:08 +0000 (12:15 +0200)
committerHeikki Linnakangas <heikki.linnakangas@iki.fi>
Wed, 9 Feb 2011 10:23:07 +0000 (12:23 +0200)
also take the RW-conflict pool into account in the PredicateLockShmemSize()
estimate.

src/backend/storage/lmgr/predicate.c

index b66fd8678cc6c447211325b8eb72a276ae61e2f8..722d0f86be4207b153d78d98481d3dd56e51ad73 100644 (file)
@@ -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;