From 357ea85a4decebafaab750e7812f01ef90db6fb2 Mon Sep 17 00:00:00 2001
From: Melanie Plageman <melanieplageman@gmail.com>
Date: Wed, 29 Apr 2026 10:33:46 -0400
Subject: [PATCH v6 2/3] Stop masking PD_ALL_VISIBLE when checking WAL
 consistency

Setting and clearing PD_ALL_VISIBLE is WAL-logged, so there is no need
to mask it for the purposes of WAL consistency checking.

There is one minor exception, which is that when fixing VM corruption,
we clear PD_ALL_VISIBLE on the heap page without specifically emitting
WAL. This is a situation where corruption has already happened, however,
so it is okay if WAL consistency checking flags this as well.

Stop masking PD_ALL_VISIBLE, as doing so can only conceal real bugs.

Author: Melanie Plageman <melanieplageman@gmail.com>
Reviewed-by: Andres Freund <andres@anarazel.de>
Discussion: https://postgr.es/m/flat/CAAKRu_bn%2Be7F4yPFBgFbnP%2BsyJRKyNK092bjD2LKvZW7O4Svag%40mail.gmail.com
---
 src/backend/access/common/bufmask.c | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/src/backend/access/common/bufmask.c b/src/backend/access/common/bufmask.c
index 5f63d04c9cb..93e34ea38b8 100644
--- a/src/backend/access/common/bufmask.c
+++ b/src/backend/access/common/bufmask.c
@@ -53,12 +53,6 @@ mask_page_hint_bits(Page page)
 	/* Ignore PD_PAGE_FULL and PD_HAS_FREE_LINES flags, they are just hints. */
 	PageClearFull(page);
 	PageClearHasFreeLinePointers(page);
-
-	/*
-	 * PD_ALL_VISIBLE is masked during WAL consistency checking. XXX: It is
-	 * worth investigating if we could stop doing this.
-	 */
-	PageClearAllVisible(page);
 }
 
 /*
-- 
2.47.3

