pgsql: Detect and fix visibility map corruption in more cases - Mailing list pgsql-committers

From Melanie Plageman
Subject pgsql: Detect and fix visibility map corruption in more cases
Date
Msg-id E1w4L9U-000xFD-0p@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
Detect and fix visibility map corruption in more cases

Move VM corruption detection and repair into heap page pruning. This
allows VM repair during on-access pruning, not only during vacuum.

Also, expand corruption detection to cover pages marked all-visible that
contain dead tuples and tuples inserted or deleted by in-progress
transactions, rather than only all-visible pages with LP_DEAD items.

Pinning the correct VM page before on-access pruning is cheap when
compared to the cost of actually pruning. The vmbuffer is saved in the
scan descriptor, so a query should only need to pin each VM page once,
and a single VM page covers a large number of heap pages.

Author: Melanie Plageman <melanieplageman@gmail.com>
Reviewed-by: Andres Freund <andres@anarazel.de>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Kirill Reshke <reshkekirill@gmail.com>
Discussion: https://postgr.es/m/bqc4kh5midfn44gnjiqez3bjqv4zogydguvdn446riw45jcf3y%404ez66il7ebvk

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/4f7ecca84ddacbce27bdff3b78981a2bd9c9b242

Modified Files
--------------
src/backend/access/heap/pruneheap.c  | 221 ++++++++++++++++++++++++++++++++---
src/backend/access/heap/vacuumlazy.c |  89 +-------------
src/include/access/heapam.h          |  12 ++
src/tools/pgindent/typedefs.list     |   1 +
4 files changed, 221 insertions(+), 102 deletions(-)


pgsql-committers by date:

Previous
From: Heikki Linnakangas
Date:
Subject: pgsql: Don't reset 'latest_page_number' when replaying multixid truncat
Next
From: Peter Geoghegan
Date:
Subject: pgsql: Make IndexScanInstrumentation a pointer in executor scan nodes.