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