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

x4mmm@yandex-team.ru

From: Andrey Borodin <x4mmm@yandex-team.ru>
To: Michael Paquier <michael@paquier.xyz>
Cc: Bruce Momjian <bruce@momjian.us>, Peter Geoghegan <pg@bowt.ie>, Robert Haas <robertmhaas@gmail.com>, Alvaro Herrera <alvherre@alvh.no-ip.org>, Andres Freund <andres@anarazel.de>, Петър Славов <pet.slavov@gmail.com>, PostgreSQL mailing lists <pgsql-bugs@lists.postgresql.org>
Date: 2022-05-26T05:16:09Z
Lists: pgsql-bugs

> On 26 May 2022, at 08:39, Michael Paquier <michael@paquier.xyz> wrote:
> 
> On Wed, May 25, 2022 at 11:17:33PM -0400, Bruce Momjian wrote:
>> *  Caused by CREATE/REINDEX CONCURRENTLY
> 
> Yes.
> 
>> *  No way to detect which indexes were created concurrently
>> *  amcheck will be required to find corrupt indexes (options?)
> 
> amcheck would help for btree, not the other AMs.  I am not sure but
> there could be other symptoms that may not be detected by amcheck?

Noah invented a neat way to do check in pre-heapallindexed versions [0]. I think we can make GiST and some others AMs be checked this way.

BTW, patches for GiST and GIN verification are circulating in pgsql-hackers. Would anyone be interested in reviewing? If so - I'll add heapallindexed to GiST verification.
Last GIN version by Heikki was in a good condition, though without heapallindexed AFAIK. [1] [2]


Best regards, Andrey Borodin.

[0] https://github.com/postgres/postgres/blob/REL_11_STABLE/src/bin/pgbench/t/022_cic.pl#L28-L40
[1] https://www.postgresql.org/message-id/flat/a5bc2aad-464b-91bd-061d-28af0f9b634c%40iki.fi#222ef3f6cbdd6f86172b38ff7663e6a3
[2] https://www.postgresql.org/message-id/CAF3eApa07-BajjG8%2BRYx-Dr_cq28ZA0GsZmUQrGu5b2ayRhB5A%40mail.gmail.com


Commits

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

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