pgsql: Assert redirect pointers are sensible after heap_page_prune().

From: Andres Freund <andres(at)anarazel(dot)de>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Assert redirect pointers are sensible after heap_page_prune().
Date: 2022-01-14 02:15:06
Message-ID: E1n8C7O-00066k-QV@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)andres@anarazel.de>
Reviewed-By: Peter Geoghegan <pg(at)bowt(dot)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(+)

Browse pgsql-committers by date

  From Date Subject
Next Message Michael Paquier 2022-01-14 02:27:16 pgsql: Revert error handling improvements for cryptohashes
Previous Message Michael Paquier 2022-01-14 01:49:16 Re: pgsql: Improve error handling of cryptohash computations