pgsql: amcheck: Fix snapshot usage in bt_index_parent_check

From: Álvaro Herrera <alvherre(at)kurilemu(dot)de>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: amcheck: Fix snapshot usage in bt_index_parent_check
Date: 2025-12-04 17:12:57
Message-ID: E1vRCsy-002nI5-30@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

amcheck: Fix snapshot usage in bt_index_parent_check

We were using SnapshotAny to do some index checks, but that's wrong and
causes spurious errors when used on indexes created by CREATE INDEX
CONCURRENTLY. Fix it to use an MVCC snapshot, and add a test for it.

This problem came in with commit 5ae2087202af, which introduced
uniqueness check. Backpatch to 17.

Author: Mihail Nikalayeu <mihailnikalayeu(at)gmail(dot)com>
Reviewed-by: Andrey Borodin <x4mmm(at)yandex-team(dot)ru>
Backpatch-through: 17
Discussion: https://postgr.es/m/CANtu0ojmVd27fEhfpST7RG2KZvwkX=dMyKUqg0KM87FkOSdz8Q@mail.gmail.com

Branch
------
REL_17_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/ce2f575b7cf4ac9dbebed4df226b7de64c7d340d

Modified Files
--------------
contrib/amcheck/t/002_cic.pl | 23 +++++++++++
contrib/amcheck/verify_nbtree.c | 86 +++++++++++++++++------------------------
doc/src/sgml/amcheck.sgml | 2 +-
3 files changed, 60 insertions(+), 51 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Andres Freund 2025-12-04 17:30:28 Re: pgsql: Add pg_atomic_unlocked_write_u64
Previous Message Nathan Bossart 2025-12-04 16:03:22 Re: pgsql: Add pg_atomic_unlocked_write_u64