From 41c184bc642b25f67fb1d8ee290f28805fa5a0b4 Mon Sep 17 00:00:00 2001 From: Fujii Masao Date: Wed, 22 Jan 2020 11:56:34 +0900 Subject: Add GUC ignore_invalid_pages. Detection of WAL records having references to invalid pages during recovery causes PostgreSQL to raise a PANIC-level error, aborting the recovery. Setting ignore_invalid_pages to on causes the system to ignore those WAL records (but still report a warning), and continue recovery. This behavior may cause crashes, data loss, propagate or hide corruption, or other serious problems. However, it may allow you to get past the PANIC-level error, to finish the recovery, and to cause the server to start up. Author: Fujii Masao Reviewed-by: Michael Paquier Discussion: https://www.postgresql.org/message-id/CAHGQGwHCK6f77yeZD4MHOnN+PaTf6XiJfEB+Ce7SksSHjeAWtg@mail.gmail.com --- src/backend/access/transam/xlogutils.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/backend/access/transam/xlogutils.c') diff --git a/src/backend/access/transam/xlogutils.c b/src/backend/access/transam/xlogutils.c index b55c3833703..b217ffa52ff 100644 --- a/src/backend/access/transam/xlogutils.c +++ b/src/backend/access/transam/xlogutils.c @@ -31,6 +31,9 @@ #include "utils/rel.h" +/* GUC variable */ +bool ignore_invalid_pages = false; + /* * During XLOG replay, we may see XLOG records for incremental updates of * pages that no longer exist, because their relation was later dropped or @@ -93,7 +96,8 @@ log_invalid_page(RelFileNode node, ForkNumber forkno, BlockNumber blkno, if (reachedConsistency) { report_invalid_page(WARNING, node, forkno, blkno, present); - elog(PANIC, "WAL contains references to invalid pages"); + elog(ignore_invalid_pages ? WARNING : PANIC, + "WAL contains references to invalid pages"); } /* @@ -240,7 +244,8 @@ XLogCheckInvalidPages(void) } if (foundone) - elog(PANIC, "WAL contains references to invalid pages"); + elog(ignore_invalid_pages ? WARNING : PANIC, + "WAL contains references to invalid pages"); hash_destroy(invalid_page_tab); invalid_page_tab = NULL; -- cgit v1.2.3