Re: Support for REINDEX CONCURRENTLY

From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: Simon Riggs <simon(at)2ndquadrant(dot)com>
Cc: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Support for REINDEX CONCURRENTLY
Date: 2012-12-08 12:22:13
Message-ID: CAB7nPqTWGChpiHx0bBeA37dHGKTEgMn0MnMN2G0RRqpY6cw92A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Dec 7, 2012 at 10:33 PM, Simon Riggs <simon(at)2ndquadrant(dot)com> wrote:

> On 7 December 2012 12:37, Michael Paquier <michael(dot)paquier(at)gmail(dot)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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2012-12-08 12:24:47 Re: Support for REINDEX CONCURRENTLY
Previous Message Simon Riggs 2012-12-08 10:16:47 Re: Commits 8de72b and 5457a1 (COPY FREEZE)