Re: unsafe use of hash_search(... HASH_ENTER ...) - Mailing list pgsql-hackers

From Tom Lane
Subject Re: unsafe use of hash_search(... HASH_ENTER ...)
Date
Msg-id 7209.1118294400@sss.pgh.pa.us
Whole thread Raw
In response to Re: unsafe use of hash_search(... HASH_ENTER ...)  ("Qingqing Zhou" <zhouqq@cs.toronto.edu>)
List pgsql-hackers
"Qingqing Zhou" <zhouqq@cs.toronto.edu> writes:
> Yeah, you are right. I scratched elog/ereport(FATAL/PANIC), only found this
> one might be a suspect:

>  In _hash_expandtable():

>  if (!_hash_try_getlock(rel, start_nblkno, HASH_EXCLUSIVE))
>   elog(PANIC, "could not get lock on supposedly new bucket");

> Or maybe elog(PANIC) is a false alarm here?

[ eyes code... ]  I think the reason it wants to PANIC is because it's
already hacked up the hash metapage in shared buffers, and it needs
to prevent that update from getting written out.  A CRIT_SECTION
would probably be a better answer --- thanks for spotting that.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Mark Kirkwood
Date:
Subject: Re: pg_config --configure ...
Next
From: Tom Lane
Date:
Subject: Re: interval->day AdjustIntervalForTypmod?