Detect and fix visibility map corruption in more cases
Melanie Plageman <melanieplageman@gmail.com>
Author:
Melanie Plageman <melanieplageman@gmail.com>
Date: 2026-03-22T15:52:40Z
Releases:
19 (unreleased)
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
Files
| Path | Change | +/− |
|---|---|---|
| src/backend/access/heap/pruneheap.c | modified | +206 −15 |
| src/backend/access/heap/vacuumlazy.c | modified | +2 −87 |
| src/include/access/heapam.h | modified | +12 −0 |
| src/tools/pgindent/typedefs.list | modified | +1 −0 |
Discussion
- eliminate xl_heap_visible to reduce WAL (and eventually set VM on-access) 168 messages · 2025-06-23 → 2026-04-21