Forget invalid VM pages during truncation replay

Commit ed62d26caca made heap records that clear visibility map bits
register VM blocks, causing redo to read those blocks with RBM_NORMAL.
If such a record is replayed after the VM fork was already truncated on
disk, recovery records a missing-page reference. Replaying the
truncation only forgot missing pages from the main fork, so recovery
later PANICs with unresolved invalid pages.

Call XLogTruncateRelation() for the VM fork when replaying a VM
truncation.

Reported-by: Jacky Nguyen <[email protected]>
Reviewed-by: Kirill Reshke <[email protected]>
Reviewed-by: Shihao Zhong <[email protected]>
Reviewed-by: Rahul Yadav <[email protected]>
Discussion: 
https://postgr.es/m/CAL4mQLAp562c1rCgg2Dqx6TBSdOk6vOvaLFjwFG9E6k4uwvJJw%40mail.gmail.com
Backpatch-through: 17

Branch
------
REL_18_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/362c66ff9bb14d43d012896e16cb1aff1054b52d

Modified Files
--------------
.../pg_visibility/t/001_concurrent_transaction.pl  | 51 +++++++++++++++++++++-
src/backend/catalog/storage.c                      | 12 ++++-
2 files changed, 60 insertions(+), 3 deletions(-)

Reply via email to