Dan Ports <d...@csail.mit.edu> wrote: > I think for SerializableXidHash we should probably just initially > allocate it at its maximum size. Then it'll match the PredXact > list which is allocated in full upfront, and there's no risk of > being able to allocate a transaction but not register its xid. In > fact, I believe there would be no way for starting a new > serializable transaction to fail. To be more precise, it would prevent an out of shared memory error during an attempt to register an xid for an active serializable transaction. That seems like a good thing. Patch to remove the hint and initially allocate that HTAB at full size attached. I didn't attempt to address the larger general issue of one HTAB stealing shared memory from space calculated to belong to another, and then holding on to it until the postmaster is shut down. -Kevin
*** a/src/backend/storage/lmgr/predicate.c --- b/src/backend/storage/lmgr/predicate.c *************** *** 1018,1024 **** InitPredicateLocks(void) * PredicateLockShmemSize! */ max_table_size = (MaxBackends + max_prepared_xacts); - init_table_size = max_table_size / 2; /* * Allocate a list to hold information on transactions participating in --- 1018,1023 ---- *************** *** 1029,1035 **** InitPredicateLocks(void) * be summarized for storage in SLRU and the "dummy" transaction. */ max_table_size *= 10; - init_table_size *= 10; PredXact = ShmemInitStruct("PredXactList", PredXactListDataSize, --- 1028,1033 ---- *************** *** 1092,1098 **** InitPredicateLocks(void) hash_flags = (HASH_ELEM | HASH_FUNCTION); SerializableXidHash = ShmemInitHash("SERIALIZABLEXID hash", ! init_table_size, max_table_size, &info, hash_flags); --- 1090,1096 ---- hash_flags = (HASH_ELEM | HASH_FUNCTION); SerializableXidHash = ShmemInitHash("SERIALIZABLEXID hash", ! max_table_size, max_table_size, &info, hash_flags); *************** *** 1595,1604 **** RegisterPredicateLockingXid(const TransactionId xid) &sxidtag, HASH_ENTER, &found); if (!sxid) ereport(ERROR, (errcode(ERRCODE_OUT_OF_MEMORY), ! errmsg("out of shared memory"), ! errhint("You might need to increase max_predicate_locks_per_transaction."))); Assert(!found); --- 1593,1602 ---- &sxidtag, HASH_ENTER, &found); if (!sxid) + /* This should not be possible, based on allocation. */ ereport(ERROR, (errcode(ERRCODE_OUT_OF_MEMORY), ! errmsg("out of shared memory"))); Assert(!found);
-- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers