Dan Ports <d...@csail.mit.edu> wrote: > I am surprised to see that error message without SSI's hint about > increasing max_predicate_locks_per_xact. After reviewing this, I think something along the following lines might be needed, for a start. I'm not sure the Asserts are actually needed; they basically are checking that the current behavior of hash_search doesn't change. I'm still looking at whether it's sane to try to issue a warning when an HTAB exceeds the number of entries declared as its max_size when it was created. -Kevin
--- a/src/backend/storage/lmgr/predicate.c +++ b/src/backend/storage/lmgr/predicate.c @@ -1604,12 +1604,7 @@ RegisterPredicateLockingXid(const TransactionId xid) sxid = (SERIALIZABLEXID *) hash_search(SerializableXidHash, &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(sxid != NULL); Assert(!found); /* Initialize the structure. */ @@ -2046,7 +2041,7 @@ CreatePredicateLock(const PREDICATELOCKTARGETTAG *targettag, target = (PREDICATELOCKTARGET *) hash_search_with_hash_value(PredicateLockTargetHash, targettag, targettaghash, - HASH_ENTER, &found); + HASH_ENTER_NULL, &found); if (!target) ereport(ERROR, (errcode(ERRCODE_OUT_OF_MEMORY), @@ -2061,7 +2056,7 @@ CreatePredicateLock(const PREDICATELOCKTARGETTAG *targettag, lock = (PREDICATELOCK *) hash_search_with_hash_value(PredicateLockHash, &locktag, PredicateLockHashCodeFromTargetHashCode(&locktag, targettaghash), - HASH_ENTER, &found); + HASH_ENTER_NULL, &found); if (!lock) ereport(ERROR, (errcode(ERRCODE_OUT_OF_MEMORY), @@ -3252,7 +3247,7 @@ ReleaseOneSerializableXact(SERIALIZABLEXACT *sxact, bool partial, predlock = hash_search_with_hash_value(PredicateLockHash, &tag, PredicateLockHashCodeFromTargetHashCode(&tag, targettaghash), - HASH_ENTER, &found); + HASH_ENTER_NULL, &found); if (!predlock) ereport(ERROR, (errcode(ERRCODE_OUT_OF_MEMORY), @@ -4279,10 +4274,7 @@ predicatelock_twophase_recover(TransactionId xid, uint16 info, sxid = (SERIALIZABLEXID *) hash_search(SerializableXidHash, &sxidtag, HASH_ENTER, &found); - if (!sxid) - ereport(ERROR, - (errcode(ERRCODE_OUT_OF_MEMORY), - errmsg("out of shared memory"))); + Assert(sxid != NULL); Assert(!found); sxid->myXact = (SERIALIZABLEXACT *) sxact;
-- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers