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@and...@anarazel.de> Reviewed-By: Peter Geoghegan <p...@bowt.ie> Discussion: https://postgr.es/m/20211122175914.ayk6gg6nvdwuh...@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(+)