pgsql: Add amcheck verification of heap relations belonging to btree in

From: Andres Freund <andres(at)anarazel(dot)de>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Add amcheck verification of heap relations belonging to btree in
Date: 2018-04-01 03:07:39
Message-ID: E1f2TLH-0002qX-5m@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Add amcheck verification of heap relations belonging to btree indexes.

Add a new, optional, capability to bt_index_check() and
bt_index_parent_check(): check that each heap tuple that should have an
index entry does in fact have one. The extra checking is performed at
the end of the existing nbtree checks.

This is implemented by using a Bloom filter data structure. The
implementation performs set membership tests within a callback (the same
type of callback that each index AM registers for CREATE INDEX). The
Bloom filter is populated during the initial index verification scan.

Reusing the CREATE INDEX infrastructure allows the new verification
option to automatically benefit from the heap consistency checks that
CREATE INDEX already performs. CREATE INDEX does thorough sanity
checking of HOT chains, so the new check actually manages to detect
problems in heap-only tuples.

Author: Peter Geoghegan
Reviewed-By: Pavan Deolasee, Andres Freund
Discussion: https://postgr.es/m/CAH2-Wzm5VmG7cu1N-H=nnS57wZThoSDQU+F5dewx3o84M+jY=g@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/7f563c09f8901f6acd72cb8fba7b1bd3cf3aca8e

Modified Files
--------------
contrib/amcheck/Makefile | 2 +-
contrib/amcheck/amcheck--1.0--1.1.sql | 29 +++
contrib/amcheck/amcheck.control | 2 +-
contrib/amcheck/expected/check_btree.out | 12 +-
contrib/amcheck/sql/check_btree.sql | 7 +-
contrib/amcheck/verify_nbtree.c | 343 ++++++++++++++++++++++++++++---
doc/src/sgml/amcheck.sgml | 126 +++++++++---
7 files changed, 458 insertions(+), 63 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Andres Freund 2018-04-01 03:30:29 pgsql: Fix non-portable use of round().
Previous Message Andres Freund 2018-04-01 01:36:20 pgsql: Add Bloom filter implementation.