Re: Tricky bugs in concurrent index build

From: Hannu Krosing <hannu(at)skype(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Greg Stark <gsstark(at)mit(dot)edu>, "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>, Greg Stark <stark(at)enterprisedb(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Tricky bugs in concurrent index build
Date: 2006-08-23 13:22:52
Message-ID: 1156339372.2961.38.camel@localhost.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Ühel kenal päeval, K, 2006-08-23 kell 09:01, kirjutas Tom Lane:
> Greg Stark <gsstark(at)mit(dot)edu> writes:
> > Hmmm. Or is that true. The problem may be somewhat easier since at least you
> > can be sure every tuple in the heap is in the index. So if you see a
> > DELETE_IN_PROGRESS either it *was* a constraint violation prior to the delete
> > and failing is reasonable or it's an update in which case maybe it's possible
> > to detect that they're part of the same chain?
>
> Unless we are willing to lock every single tuple while we insert it,
> this seems unfixable to me. Without a lock, the tuple could become
> DELETE_IN_PROGRESS immediately after we look at it.
>
> Actually it's worse than that. We could examine a tuple, see that
> it's good, include it in the uniqueness check. Then someone updates
> the tuple and puts the new version near the end of the table. By
> the time we reach that version, it could be committed good.

Perhaps we should scan the index in index order, and set the unique flag
per index page.

That would
a) help us avoid going to heap unless there are multiple entries for
some value and
b) enable us, once all index pages containing pointers to some possibly
duplicate value are checked, to release locks on those tuples.

--
----------------
Hannu Krosing
Database Architect
Skype Technologies OÜ
Akadeemia tee 21 F, Tallinn, 12618, Estonia

Skype me: callto:hkrosing
Get Skype for free: http://www.skype.com

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Magnus Hagander 2006-08-23 13:23:41 Re: seahorse again failing
Previous Message Alvaro Herrera 2006-08-23 13:19:24 Re: [HACKERS] COPY view