Re: Bugs in CREATE/DROP INDEX CONCURRENTLY

From: "Kevin Grittner" <kgrittn(at)mail(dot)com>
To: "Kevin Grittner" <kgrittn(at)mail(dot)com>,"Simon Riggs" <simon(at)2ndQuadrant(dot)com>,"Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Bugs in CREATE/DROP INDEX CONCURRENTLY
Date: 2012-10-17 22:51:06
Message-ID: 20121017225106.155630@gmx.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Kevin Grittner wrote:
> Simon Riggs wrote:
>> On 6 October 2012 00:56, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>  
>>> 2. DROP INDEX CONCURRENTLY doesn't bother to do
>>> TransferPredicateLocksToHeapRelation until long after it's
>>> invalidated the index. Surely that's no good? Is it even possible
>>> to do that correctly, when we don't have a lock that will prevent
>>> new predicate locks from being taken out meanwhile?
>>
>> No idea there. Input appreciated.

> If the creation of a new tuple by insert or update would not
> perform the related index tuple insertion, and the lock has not yet
> been transfered to the heap relation, yes we have a problem.  Will
> take a look at the code.
>
> Creation of new predicate locks while in this state has no bearing
> on the issue as long as locks are transferred to the heap relation
> after the last scan using the index has completed.

To put that another way, it should be done at a time when it is sure
that no query sees indisvalid = true and no query has yet seen
indisready = false.  Patch attached.  Will apply if nobody sees a
problem with it.

-Kevin

Attachment Content-Type Size
drop-index-concurrently-predicate-locks-v1.patch text/x-patch 1.8 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message ichbinrene 2012-10-17 22:55:03 Re: BUG #7521: Cannot disable WAL log while using pg_dump
Previous Message Josh Berkus 2012-10-17 22:24:57 Re: Deprecating RULES