Re: REINDEX CONCURRENTLY 2.0

From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: Jim Nasby <jim(at)nasby(dot)net>
Cc: PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: REINDEX CONCURRENTLY 2.0
Date: 2014-01-21 13:12:25
Message-ID: CAB7nPqTZfx20Ra2Wf4Gm0a=NqF4q2aC8Q6OS8vKN6fhnD=cUxQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

Thanks for your comments.

On Fri, Jan 10, 2014 at 9:59 AM, Jim Nasby <jim(at)nasby(dot)net> wrote:
> Sorry for the lateness of this...
>
> On 11/14/13, 8:40 PM, Michael Paquier wrote:
>>
>> + /*
>> + * Phase 4 of REINDEX CONCURRENTLY
>> + *
>> + * Now that the concurrent indexes have been validated could be
>> used,
>> + * we need to swap each concurrent index with its corresponding
>> old index.
>> + * Note that the concurrent index used for swaping is not marked
>> as valid
>> + * because we need to keep the former index and the concurrent
>> index with
>> + * a different valid status to avoid an implosion in the number of
>> indexes
>> + * a parent relation could have if this operation fails multiple
>> times in
>> + * a row due to a reason or another. Note that we already know
>> thanks to
>> + * validation step that
>> + */
>> +
>
>
> Was there supposed to be more to that comment?
Not really, it seems that this chunk came out after writing multiple
successive versions of this patch.

> In the loop right below it...
>
> + /* Swap the indexes and mark the indexes that have the old data as
> invalid */
> + forboth(lc, indexIds, lc2, concurrentIndexIds)
> ...
> + CacheInvalidateRelcacheByRelid(relOid);
>
> Do we actually need to invalidate the cache on each case? Is it because
> we're grabbing a new transaction each time through?
This is to force a refresh of the cached plans that have been using
the old index before transaction of step 4 began.

I have realigned this patch with latest head (d2458e3)... In case
someone is interested at some point...

Regards,
--
Michael

Attachment Content-Type Size
20140121_0_old_snapshots.patch text/x-diff 6.6 KB
20140121_1_reindex_conc_core.patch text/x-diff 71.4 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alexander Korotkov 2014-01-21 13:14:31 Re: GIN improvements part 1: additional information
Previous Message Michael Paquier 2014-01-21 12:47:31 Re: ALTER SYSTEM SET typos and fix for temporary file name management