pgsql: Assert redirect pointers are sensible after heap_page_prune(). - Mailing list pgsql-committers

From Andres Freund
Subject pgsql: Assert redirect pointers are sensible after heap_page_prune().
Date
Msg-id E1n8C7O-00066k-QV@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
Assert redirect pointers are sensible after heap_page_prune().

Corruption of redirect item pointers often only becomes visible well after
being corrupted, as e.g. bug #17255 shows: In the original reproducer,
gigabyte of WAL were between the source of the corruption and the corruption
becoming visible.

To make it easier to find / prevent such bugs, verify whether redirect
pointers are sensible at the end of heap_page_prune_execute(). 5cd7eb1f1c32
introduced related assertions while modifying the page, but they can't easily
detect marking the target of an existing redirect as unused. Sometimes the
corruption will be detected later, but that's harder to diagnose.

Author: Andres Freund <andres@andres@anarazel.de>
Reviewed-By: Peter Geoghegan <pg@bowt.ie>
Discussion: https://postgr.es/m/20211122175914.ayk6gg6nvdwuhrzb@alap3.anarazel.de

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/bb42bfb5ccb5f138a8b7ad3549cfb05c0cc5187b

Modified Files
--------------
src/backend/access/heap/pruneheap.c | 57 +++++++++++++++++++++++++++++++++++++
1 file changed, 57 insertions(+)


pgsql-committers by date:

Previous
From: Tom Lane
Date:
Subject: pgsql: Fix ruleutils.c's dumping of whole-row Vars in more contexts.
Next
From: Michael Paquier
Date:
Subject: pgsql: Revert error handling improvements for cryptohashes