Re: SSI bug?

From: "Kevin Grittner" <Kevin(dot)Grittner(at)wicourts(dot)gov>
To: "Heikki Linnakangas" <heikki(dot)linnakangas(at)enterprisedb(dot)com>
Cc: "Dan Ports" <drkp(at)csail(dot)mit(dot)edu>, "YAMAMOTO Takashi" <yamt(at)mwd(dot)biglobe(dot)ne(dot)jp>, <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: SSI bug?
Date: 2011-03-31 19:06:53
Message-ID: 4D948A7D020000250003C012@gw.wicourts.gov
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com> wrote:

> That's not enough. The hash tables can grow beyond the maximum
> size you specify in ShmemInitHash. It's just a hint to size the
> directory within the hash table.
>
> We'll need to teach dynahash not to allocate any more entries
> after the preallocation. A new HASH_NO_GROW flag to hash_create()
> seems like a suitable interface.

OK. If we're doing that, is it worth taking a look at the "safety
margin" added to the size calculations, and try to make the
calculations more accurate?

Would you like me to code a patch for this?

There are a couple other patches which I think should be applied, if
you have time to deal with them.

There was a fix for an assertion failure here:

http://archives.postgresql.org/pgsql-bugs/2011-03/msg00352.php

It just rechecks some conditions after dropping a shared LW lock and
acquiring an exclusive LW lock. Without this recheck there is a
window for the other transaction involved in the conflict to also
detect a conflict and flag first, leading to the assertion.

There's another area I need to review near there, but that is
orthogonal.

There is a patch to improve out-of-shared-memory error handling and
reporting here:

http://archives.postgresql.org/pgsql-hackers/2011-03/msg01170.php

This one is due to my earlier failure to spot the difference between
HASH_ENTER and HASH_ENTER_NULL. For a shared memory HTAB the
HASH_ENTER_NULL will return a null if unable to allocate the entry,
while HASH_ENTER will ereport ERROR with a generic message. This
patch leaves HASH_ENTER on the "can't happen" cases, but replaces
the ereport ERROR after it with an Assert because it's something
which should never happen. The other cases are changed to
HASH_ENTER_NULL so that the error message with the hint will be used
instead of the more generic message.

These patches are both in direct response to problems found during
testing by YAMAMOTO Takashi.

-Kevin

In response to

  • Re: SSI bug? at 2011-03-31 18:31:37 from Heikki Linnakangas

Responses

  • Re: SSI bug? at 2011-04-11 08:33:06 from Heikki Linnakangas

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2011-03-31 19:14:47 Re: Bug in autovacuum.c?
Previous Message Bruce Momjian 2011-03-31 18:59:38 Re: Bug in autovacuum.c?