1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-27 12:41:57 +03:00

Revert changes to CONCURRENTLY that "sped up" Xmin advance

This reverts commit d9d076222f "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 <pet.slavov@gmail.com>
Diagnosys-by: Andrey Borodin <x4mmm@yandex-team.ru>
Diagnosys-by: Michael Paquier <michael@paquier.xyz>
Diagnosys-by: Andres Freund <andres@anarazel.de>
Discussion: https://postgr.es/m/17485-396609c6925b982d%40postgresql.org
This commit is contained in:
Alvaro Herrera
2022-05-31 21:24:59 +02:00
parent 16c80e7d0c
commit e28bb88519
3 changed files with 7 additions and 36 deletions

View File

@ -861,8 +861,6 @@ Indexes:
Like any long-running transaction, <command>CREATE INDEX</command> on a
table can affect which tuples can be removed by concurrent
<command>VACUUM</command> on any other table.
Excepted from this are operations with the <literal>CONCURRENTLY</literal>
option for indexes that are not partial and do not index any expressions.
</para>
<para>

View File

@ -475,8 +475,6 @@ Indexes:
Like any long-running transaction, <command>REINDEX</command> on a table
can affect which tuples can be removed by concurrent
<command>VACUUM</command> on any other table.
Excepted from this are operations with the <literal>CONCURRENTLY</literal>
option for indexes that are not partial and do not index any expressions.
</para>
<para>