From: Melanie Plageman Date: Wed, 10 Dec 2025 16:10:13 +0000 (-0500) Subject: Add comment about keeping PD_ALL_VISIBLE and VM in sync X-Git-Url: http://git.postgresql.org/gitweb/?a=commitdiff_plain;h=eebec3ca4b5ef13d01837966f51b391143670131;p=users%2Frhaas%2Fpostgres.git Add comment about keeping PD_ALL_VISIBLE and VM in sync The comment above heap_xlog_visible() about the critical integrity requirement for PD_ALL_VISIBLE and the visibility map should also be in heap_xlog_prune_freeze() where we set PD_ALL_VISIBLE. Oversight in add323da40a6bf9e Author: Melanie Plageman Discussion: https://postgr.es/m/flat/CAAKRu_ZMw6Npd_qm2KM%2BFwQ3cMOMx1Dh3VMhp8-V7SOLxdK9-g%40mail.gmail.com --- diff --git a/src/backend/access/heap/heapam_xlog.c b/src/backend/access/heap/heapam_xlog.c index 11cb3f74da..a09fb4b803 100644 --- a/src/backend/access/heap/heapam_xlog.c +++ b/src/backend/access/heap/heapam_xlog.c @@ -157,6 +157,12 @@ heap_xlog_prune_freeze(XLogReaderState *record) /* There should be no more data */ Assert((char *) frz_offsets == dataptr + datalen); + /* + * The critical integrity requirement here is that we must never end + * up with the visibility map bit set and the page-level + * PD_ALL_VISIBLE bit unset. If that were to occur, a subsequent page + * modification would fail to clear the visibility map bit. + */ if (vmflags & VISIBILITYMAP_VALID_BITS) PageSetAllVisible(page);