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

From Michael Paquier
Subject Re: Support for REINDEX CONCURRENTLY
Date
Msg-id CAB7nPqTWGChpiHx0bBeA37dHGKTEgMn0MnMN2G0RRqpY6cw92A@mail.gmail.com
Whole thread Raw
In response to Re: Support for REINDEX CONCURRENTLY  (Simon Riggs <simon@2ndQuadrant.com>)
List pgsql-hackers


On Fri, Dec 7, 2012 at 10:33 PM, Simon Riggs <simon@2ndquadrant.com> wrote:
On 7 December 2012 12:37, Michael Paquier <michael.paquier@gmail.com> wrote:
> - There is still a problem with toast indexes. If the concurrent reindex of
> a toast index fails for a reason or another, pg_relation will finish with
> invalid toast index entries. I am still wondering about how to clean up
> that. Any ideas?

Build another toast index, rather than reindexing the existing one,
then just use the new oid.
Hum? The patch already does that. It creates concurrently a new index which is a duplicate of the existing one, then the old and new indexes are swapped. Finally the old index is dropped concurrently.

The problem I still see is the following one:
If a toast index, or a relation having a toast index, is being reindexed concurrently, and that the server crashes during the process, there will be invalid toast indexes in the server. If the crash happens before the swap, the new toast index is invalid. If the crash happens after the swap, the old toast index is invalid.
I am not sure the user is able to clean up such invalid toast indexes manually as they are not visible to him.
--
Michael Paquier
http://michael.otacoo.com

pgsql-hackers by date:

Previous
From: Simon Riggs
Date:
Subject: Re: Commits 8de72b and 5457a1 (COPY FREEZE)
Next
From: Michael Paquier
Date:
Subject: Re: Support for REINDEX CONCURRENTLY