Re: BUG #5157: Hash index not concurrency safe

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Jeff Janes <jeff(dot)janes(at)gmail(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #5157: Hash index not concurrency safe
Date: 2009-11-01 18:08:29
Message-ID: 23029.1257098909@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

I wrote:
> Jeff Janes <jeff(dot)janes(at)gmail(dot)com> writes:
>> Hash index is not concurrency safe, starting in REL8_4_0 and up to HEAD.

> Ouch. This used to be okay, because adding new entries to a hash page
> always added them at the end. The 8.4 changes to keep individual hash
> pages sorted by hashcode broke it :-(.

Actually, now that I am looking at it, that patch COMPLETELY destroyed
hash indexes. The search logic requires that index entries within a
page are ordered by hash value. Although the insertion code preserves
that property, neither _hash_splitbucket nor _hash_squeezebucket make
any attempt to do so. So it's not just a transient concurrency issue,
you can easily get corruption of a hash index leading to permanent
search failures.

Ugh. Mea culpa for letting this one through.

regards, tom lane

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2009-11-01 22:35:13 Re: BUG #5157: Hash index not concurrency safe
Previous Message Tom Lane 2009-11-01 17:22:42 Re: BUG #5157: Hash index not concurrency safe