Re: BUG #17485: Records missing from Primary Key index when doing REINDEX INDEX CONCURRENTLY

Peter Geoghegan <pg@bowt.ie>

From: Peter Geoghegan <pg@bowt.ie>
To: Michael Paquier <michael@paquier.xyz>
Cc: Andrey Borodin <x4mmm@yandex-team.ru>, Alvaro Herrera <alvherre@alvh.no-ip.org>, Петър Славов <pet.slavov@gmail.com>, PostgreSQL mailing lists <pgsql-bugs@lists.postgresql.org>
Date: 2022-05-24T02:19:50Z
Lists: pgsql-bugs
On Mon, May 23, 2022 at 6:20 PM Michael Paquier <michael@paquier.xyz> wrote:
> > And I observe that commenting out condition in following code fixes the test.
> >             //if (!(statusFlags & PROC_IN_SAFE_IC))
> >                 h->data_oldest_nonremovable =
> >                     TransactionIdOlder(h->data_oldest_nonremovable, xmin);
>
> Well, by doing so, I think that you are just making the CIC/REINDEX
> wait again until the index is safe to use, but we want to skip this
> wait as of the optimization done in d9d0762.

Uh...isn't that exactly the point that Andrey made himself, in posting
the snippet?

You seem to be addressing this PROC_IN_SAFE_IC snippet as if Andrey
formally proposed it as a bugfix, which seems like an odd
interpretation to me. It seems pretty clear to me that Andrey was just
making an observation, in case it helped with debugging.

--
Peter Geoghegan



Commits

  1. Revert changes to CONCURRENTLY that "sped up" Xmin advance

  2. Fix possible HOT corruption when RECENTLY_DEAD changes to DEAD while pruning.