Re: Support for REINDEX CONCURRENTLY

Поиск
Список
Период
Сортировка
От Michael Paquier
Тема Re: Support for REINDEX CONCURRENTLY
Дата
Msg-id CAB7nPqTGmyiiTrnM97DiVAhRU5jv7D2YF9E_BCd2iGsa9xTnKA@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Support for REINDEX CONCURRENTLY  (Fujii Masao <masao.fujii@gmail.com>)
Список pgsql-hackers
On Tue, Jul 2, 2013 at 7:36 AM, Fujii Masao <masao.fujii@gmail.com> wrote:
> On Mon, Jul 1, 2013 at 9:31 AM, Michael Paquier
> <michael.paquier@gmail.com> wrote:
>> Hi all,
>>
>> Please find attached an updated version of the patch removing
>> reltoastidxid (with and w/o context diffs), patch fixing the vacuum
>> full issue. With this fix, all the comments are addressed.
>
> Thanks for updating the patch!
>
> I have one question related to VACUUM FULL problem. What happens
> if we run VACUUM FULL when there is an invalid toast index? The invalid
> toast index is rebuilt and marked as valid, i.e., there can be multiple valid
> toast indexes?
The invalid toast indexes are not rebuilt. With the design of this
patch, toast relations can only have one valid index at the same time,
and this is also the path taken by REINDEX CONCURRENTLY for toast
relations. This process is managed by this code in cluster.c, only the
valid index of toast relation is taken into account when rebuilding
relations:
***************
*** 1393,1410 **** swap_relation_files(Oid r1, Oid r2, bool target_is_pg_class,
       /*        * If we're swapping two toast tables by content, do the same for their
!        * indexes.        */       if (swap_toast_by_content &&
!               relform1->reltoastidxid && relform2->reltoastidxid)
!               swap_relation_files(relform1->reltoastidxid,
!                                                       relform2->reltoastidxid,
              target_is_pg_class,                                                       swap_toast_by_content,
                                            is_internal,
InvalidTransactionId,                                                      InvalidMultiXactId,
                            mapped_tables);
 
       /* Clean up. */       heap_freetuple(reltup1);
--- 1392,1421 ----
       /*        * If we're swapping two toast tables by content, do the same for their
!        * valid index. The swap can actually be safely done only if
the relations
!        * have indexes.        */       if (swap_toast_by_content &&
!               relform1->relkind == RELKIND_TOASTVALUE &&
!               relform2->relkind == RELKIND_TOASTVALUE)
!       {
!               Oid                     toastIndex1, toastIndex2;
!
!               /* Get valid index for each relation */
!               toastIndex1 = toast_get_valid_index(r1,
!                AccessExclusiveLock);
!               toastIndex2 = toast_get_valid_index(r2,
!                AccessExclusiveLock);
!
!               swap_relation_files(toastIndex1,
!                                                       toastIndex2,
  target_is_pg_class,                                                       swap_toast_by_content,
                                is_internal,
InvalidTransactionId,                                                      InvalidMultiXactId,
                            mapped_tables);
 
+       }

Regards,
--
Michael



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Fujii Masao
Дата:
Сообщение: Re: Support for REINDEX CONCURRENTLY
Следующее
От: Peter Eisentraut
Дата:
Сообщение: Re: PL/Lua (was: plpython implementation)