Re: Support for REINDEX CONCURRENTLY - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Support for REINDEX CONCURRENTLY
Date
Msg-id 4639.1349274539@sss.pgh.pa.us
Whole thread Raw
In response to Re: Support for REINDEX CONCURRENTLY  (Andres Freund <andres@2ndquadrant.com>)
Responses Re: Support for REINDEX CONCURRENTLY  (Andres Freund <andres@2ndquadrant.com>)
List pgsql-hackers
Andres Freund <andres@2ndquadrant.com> writes:
> Maybe I am missing something here, but reindex concurrently should do
> 1) BEGIN
> 2) Lock table in share update exlusive
> 3) lock old index
> 3) create new index
> 4) obtain session locks on table, old index, new index
> 5) commit
> 6) process till newindex->insisready (no new locks)
> 7) process till newindex->indisvalid (no new locks)
> 8) process till !oldindex->indisvalid (no new locks)
> 9) process till !oldindex->indisready (no new locks)
> 10) drop all session locks
> 11) lock old index exlusively which should be "invisible" now
> 12) drop old index

You can't drop the session locks until you're done.  Consider somebody
else trying to do a DROP TABLE between steps 10 and 11, for instance.
        regards, tom lane



pgsql-hackers by date:

Previous
From: Fabrízio de Royes Mello
Date:
Subject: Re: CREATE SCHEMA IF NOT EXISTS
Next
From: Alvaro Herrera
Date:
Subject: Re: [9.1] 2 bugs with extensions