Revert changes to CONCURRENTLY that "sped up" Xmin advance
authorAlvaro Herrera <[email protected]>
Tue, 31 May 2022 19:24:59 +0000 (21:24 +0200)
committerAlvaro Herrera <[email protected]>
Tue, 31 May 2022 19:24:59 +0000 (21:24 +0200)
commite28bb885196916b0a3d898ae4f2be0e38108d81b
tree48556a8b256e64ee2d75c75aff8eb632fa144d79
parent16c80e7d0cdad933103968aec7cd024bca5274c0
Revert changes to CONCURRENTLY that "sped up" Xmin advance

This reverts commit d9d076222f5b "VACUUM: ignore indexing operations
with CONCURRENTLY".

These changes caused indexes created with the CONCURRENTLY option to
miss heap tuples that were HOT-updated and HOT-pruned during the index
creation.  Before these changes, HOT pruning would have been prevented
by the Xmin of the transaction creating the index, but because this
change was precisely to allow the Xmin to move forward ignoring that
backend, now other backends scanning the table can prune them.  This is
not a problem for VACUUM (which requires a lock that conflicts with a
CREATE INDEX CONCURRENTLY operation), but HOT-prune can definitely
occur.  In other words, Xmin advancement was sped up, but at the cost of
corrupting the resulting index.

Regrettably, this means that the new feature in PG14 that RIC/CIC on
very large tables no longer force VACUUM to retain very old tuples goes
away.  We might try to implement it again in a later release, but for
now the risk of indexes missing tuples is too high and there's no easy
fix.

Backpatch to 14, where this change appeared.

Reported-by: Peter Slavov <[email protected]>
Diagnosys-by: Andrey Borodin <[email protected]>
Diagnosys-by: Michael Paquier <[email protected]>
Diagnosys-by: Andres Freund <[email protected]>
Discussion: https://postgr.es/m/17485-396609c6925b982d%40postgresql.org
doc/src/sgml/ref/create_index.sgml
doc/src/sgml/ref/reindex.sgml
src/backend/storage/ipc/procarray.c