]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Detect and fix visibility map corruption in more cases
authorMelanie Plageman <melanieplageman@gmail.com>
Sun, 22 Mar 2026 15:52:40 +0000 (11:52 -0400)
committerMelanie Plageman <melanieplageman@gmail.com>
Sun, 22 Mar 2026 15:52:40 +0000 (11:52 -0400)
commit4f7ecca84ddacbce27bdff3b78981a2bd9c9b242
treed6435973b8f30014bd5debe9fe8368cc829c0d5d
parent516310ed4dba89bd300242df0d56b4782f33ed4d
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
src/backend/access/heap/pruneheap.c
src/backend/access/heap/vacuumlazy.c
src/include/access/heapam.h
src/tools/pgindent/typedefs.list