diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml index 619ac8c50c..99ad1d1b39 100644 *** a/doc/src/sgml/config.sgml --- b/doc/src/sgml/config.sgml *************** *** 9664,9669 **** LOG: CleanUpLock: deleting: lock(0xb7acd844) id(24688,24696,0,0,0,1) --- 9664,9691 ---- + + ignore_invalid_pages (boolean) + + ignore_invalid_pages configuration parameter + + + + + Detection of WAL records having references to invalid pages during + recovery causes PostgreSQL to report + an error, aborting the recovery. Setting + ignore_invalid_pages to true causes the system + to ignore the failure (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 error, finish the recovery, + and cause the server to start up. + The default setting is off, and it can only be set at server start. + + + + jit_debugging_support (boolean) diff --git a/src/backend/accessindex 5f1e5ba75d..5e6f47d8c1 100644 *** a/src/backend/access/transam/xlogutils.c --- b/src/backend/access/transam/xlogutils.c *************** *** 31,36 **** --- 31,39 ---- #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,99 **** 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"); } /* --- 96,103 ---- if (reachedConsistency) { report_invalid_page(WARNING, node, forkno, blkno, present); ! elog(ignore_invalid_pages ? WARNING : PANIC, ! "WAL contains references to invalid pages"); } /* *************** *** 240,246 **** XLogCheckInvalidPages(void) } if (foundone) ! elog(PANIC, "WAL contains references to invalid pages"); hash_destroy(invalid_page_tab); invalid_page_tab = NULL; --- 244,251 ---- } if (foundone) ! elog(ignore_invalid_pages ? WARNING : PANIC, ! "WAL contains references to invalid pages"); hash_destroy(invalid_page_tab); invalid_page_tab = NULL; diff --git a/src/backend/utils/misc/guc.c b/sindex 2178e1cf5e..82761db6b4 100644 *** a/src/backend/utils/misc/guc.c --- b/src/backend/utils/misc/guc.c *************** *** 122,127 **** extern int CommitSiblings; --- 122,128 ---- extern char *default_tablespace; extern char *temp_tablespaces; extern bool ignore_checksum_failure; + extern bool ignore_invalid_pages; extern bool synchronize_seqscans; #ifdef TRACE_SYNCSCAN *************** *** 1160,1165 **** static struct config_bool ConfigureNamesBool[] = --- 1161,1184 ---- false, NULL, NULL, NULL }, + { + {"ignore_invalid_pages", PGC_POSTMASTER, DEVELOPER_OPTIONS, + gettext_noop("Continues recovery after an invalid pages failure."), + gettext_noop("Detection of WAL records having references to " + "invalid pages during recovery causes PostgreSQL to " + "report an error, aborting the recovery. Setting " + "ignore_invalid_pages to true causes the system to " + "ignore the failure (but still report a warning), " + "and continue recovery. This behavior may cause " + "crashes, data loss, propagate or hide corruption, " + "or other serious problems. Only has " + "an effect during recovery."), + GUC_NOT_IN_SAMPLE + }, + &ignore_invalid_pages, + false, + NULL, NULL, NULL + }, { {"full_page_writes", PGC_SIGHUP, WAL_SETTINGS, gettext_noop("Writes full pages to WAL when first modified after a checkpoint."),