Re: BUG #18016: REINDEX TABLE failure

From: Gurjeet Singh <gurjeet(at)singh(dot)im>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Postgres Hackers <pgsql-hackers(at)postgresql(dot)org>
Cc: Michael Paquier <michael(at)paquier(dot)xyz>, richard(dot)vesely(at)softea(dot)sk, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #18016: REINDEX TABLE failure
Date: 2023-07-10 16:35:05
Message-ID: CABwTF4WX=m5pQvKXvLFJoEH=hSd6O=iZSqxVqHKjFm+iL-AO=w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

On Sun, Jul 9, 2023 at 7:18 AM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>
> Michael Paquier <michael(at)paquier(dot)xyz> writes:
> > That should be OK, I assume. However, if this is improved and
> > something we want to support in the long-run I guess that a TAP test
> > may be appropriate.
>
> I do not see the point of a TAP test. It's not like the code isn't
> covered perfectly well.

Please find attached the patch that makes REINDEX TABLE perform
reindex on toast table before reindexing the main table's indexes.

The code block movement involved slightly more thought and care than I
had previously imagined. As explained in comments in the patch, the
enumeration and suppression of indexes on the main table must happen
before any CommandCounterIncrement() call, hence the
reindex-the-toast-table-if-any code had to be placed after that
enumeration.

In support of the argument above, the patch does not include any TAP
tests. Reliably reproducing the original error message involves
restarting the database, and since that can't be done via SQL
commands, no sql tests are included, either.

The patch also includes minor wordsmithing, and benign whitespace
changes in neighboring code.

Best regards,
Gurjeet
http://Gurje.et

Attachment Content-Type Size
v1-0001-Reindex-toast-table-s-index-before-main-table-s-i.patch application/octet-stream 3.8 KB

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Gurjeet Singh 2023-07-10 16:43:49 Re: BUG #18016: REINDEX TABLE failure
Previous Message Vamshikrishna T 2023-07-10 11:27:27 Re: BUG #18009: Postgres Recovery not happening

Browse pgsql-hackers by date

  From Date Subject
Next Message Gurjeet Singh 2023-07-10 16:43:49 Re: BUG #18016: REINDEX TABLE failure
Previous Message Andres Freund 2023-07-10 16:24:15 Re: Performance degradation on concurrent COPY into a single relation in PG16.