Re: Stop masking visibility information during WAL consistency checking

From: Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)com>
To: Melanie Plageman <melanieplageman(at)gmail(dot)com>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org, surya poondla <suryapoondla4(at)gmail(dot)com>, Andres Freund <andres(at)anarazel(dot)de>, Zhijie Hou <houzhijie22(at)gmail(dot)com>, Michael Paquier <michael(at)paquier(dot)xyz>
Subject: Re: Stop masking visibility information during WAL consistency checking
Date: 2026-11-20 23:17:39
Message-ID: CAN4CZFOF77GAW2MNYcybsqn3jzQN_eYiN4Cg4bQ2hzhrOqv9kA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello

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

Claude pointed out that wal_consistency_checking can trigger an error
with 0002. This uses very specific flags, but both
full_page_writes=off and disabled data checksums are supported, so it
seems like a plausible scenario.

initdb --no-data-checksums, wal_consistency_checking = 'heap,heap2',
full_page_writes = off, autovacuum = off.

CREATE EXTENSION pg_buffercache;
CREATE TABLE t(a int);
INSERT INTO t SELECT generate_series(1, 10);
CHECKPOINT;
INSERT INTO t VALUES (11);
VACUUM t;
SELECT pg_buffercache_evict_relation('t');
-- pg_ctl stop -m immediate; pg_ctl start

FATAL: inconsistent page found, rel 1663/5/16460, forknum 0, blkno 0
CONTEXT: WAL redo at 0/01733368 for Heap/INSERT: off: 11 ...

+ /* On VM pages the apparent free space contains the visibility bitmap. */
+ if (forknum == VISIBILITYMAP_FORKNUM)
+ return;
+

And also for this change, with the same config:

CREATE TABLE u(a int) WITH (fillfactor = 10);
INSERT INTO u SELECT generate_series(1, 250);
VACUUM u;
CHECKPOINT;
DELETE FROM u WHERE a > 125;
VACUUM u; -- truncates to 6 blocks
SELECT pg_buffercache_evict_relation('u');
-- immediate stop / start
FATAL: inconsistent page found, rel 1663/5/16469, forknum 2, blkno 0

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Hannu Krosing 2026-11-20 23:21:49 Re: ZSTD TOAST compression, and an extensible compression method encoding
Previous Message Andrew Dunstan 2026-11-20 22:53:15 Re: Table AM callback for logical decoding support (REPACK CONCURRENTLY)