Skip site navigation (1) Skip section navigation (2)

Re: Support for REINDEX CONCURRENTLY

From: Greg Stark <stark(at)mit(dot)edu>
To: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Andres Freund <andres(at)2ndquadrant(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Support for REINDEX CONCURRENTLY
Date: 2012-10-04 02:31:45
Message-ID: CAM-w4HN62LU6zf+uATNLi7W5a6EGvb4r7Vy14QxZ2ngrhb4Y9A@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-hackers
On Thu, Oct 4, 2012 at 2:19 AM, Michael Paquier
<michael(dot)paquier(at)gmail(dot)com> wrote:
>> I think what you'd have to do is drop the old index (relying on the
>> assumption that no one is accessing it anymore after a certain point, so
>> you can take exclusive lock on it now) and then rename the new index
>> to have the old index's name.  However, renaming an index without
>> exclusive lock on it still seems a bit risky.  Moreover, what if you
>> crash right after committing the drop of the old index?

I think this would require a new state which is the converse of
indisvalid=f. Right now there's no state the index can be in that
means the index should be ignored for both scans and maintenance but
might have old sessions that might be using it or maintaining it.

I'm a bit puzzled why we're so afraid of swapping the relfilenodes
when that's what the current REINDEX does. It seems flaky to have two
different mechanisms depending on which mode is being used. It seems
more conservative to use the same mechanism and just figure out what's
required to ensure it's safe in both modes. At least there won't be
any bugs from unexpected consequences that aren't locking related if
it's using the same mechanics.

-- 
greg


In response to

Responses

pgsql-hackers by date

Next:From: Tom LaneDate: 2012-10-04 02:38:00
Subject: Make CREATE AGGREGATE check validity of initcond value?
Previous:From: Andrew DunstanDate: 2012-10-04 01:53:34
Subject: Re: Detecting libpq connections improperly shared via fork()

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group