Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit41c184b

Browse files
committed
Add GUC ignore_invalid_pages.
Detection of WAL records having references to invalid pagesduring recovery causes PostgreSQL to raise a PANIC-level error,aborting the recovery. Setting ignore_invalid_pages to on causesthe 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 MasaoReviewed-by: Michael PaquierDiscussion:https://www.postgresql.org/message-id/CAHGQGwHCK6f77yeZD4MHOnN+PaTf6XiJfEB+Ce7SksSHjeAWtg@mail.gmail.com
1 parent79a3efb commit41c184b

File tree

3 files changed

+52
-2
lines changed

3 files changed

+52
-2
lines changed

‎doc/src/sgml/config.sgml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9950,6 +9950,31 @@ LOG: CleanUpLock: deleting: lock(0xb7acd844) id(24688,24696,0,0,0,1)
99509950
</listitem>
99519951
</varlistentry>
99529952

9953+
<varlistentry id="guc-ignore-invalid-pages" xreflabel="ignore_invalid_pages">
9954+
<term><varname>ignore_invalid_pages</varname> (<type>boolean</type>)
9955+
<indexterm>
9956+
<primary><varname>ignore_invalid_pages</varname> configuration parameter</primary>
9957+
</indexterm>
9958+
</term>
9959+
<listitem>
9960+
<para>
9961+
If set to <literal>off</literal> (the default), detection of
9962+
WAL records having references to invalid pages during
9963+
recovery causes <productname>PostgreSQL</productname> to
9964+
raise a PANIC-level error, aborting the recovery. Setting
9965+
<varname>ignore_invalid_pages</varname> to <literal>on</literal>
9966+
causes the system to ignore invalid page references in WAL records
9967+
(but still report a warning), and continue the recovery.
9968+
This behavior may <emphasis>cause crashes, data loss,
9969+
propagate or hide corruption, or other serious problems</emphasis>.
9970+
However, it may allow you to get past the PANIC-level error,
9971+
to finish the recovery, and to cause the server to start up.
9972+
The parameter can only be set at server start. It only has effect
9973+
during recovery or in standby mode.
9974+
</para>
9975+
</listitem>
9976+
</varlistentry>
9977+
99539978
<varlistentry id="guc-jit-debugging-support" xreflabel="jit_debugging_support">
99549979
<term><varname>jit_debugging_support</varname> (<type>boolean</type>)
99559980
<indexterm>

‎src/backend/access/transam/xlogutils.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@
3131
#include"utils/rel.h"
3232

3333

34+
/* GUC variable */
35+
boolignore_invalid_pages= false;
36+
3437
/*
3538
* During XLOG replay, we may see XLOG records for incremental updates of
3639
* 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,
9396
if (reachedConsistency)
9497
{
9598
report_invalid_page(WARNING,node,forkno,blkno,present);
96-
elog(PANIC,"WAL contains references to invalid pages");
99+
elog(ignore_invalid_pages ?WARNING :PANIC,
100+
"WAL contains references to invalid pages");
97101
}
98102

99103
/*
@@ -240,7 +244,8 @@ XLogCheckInvalidPages(void)
240244
}
241245

242246
if (foundone)
243-
elog(PANIC,"WAL contains references to invalid pages");
247+
elog(ignore_invalid_pages ?WARNING :PANIC,
248+
"WAL contains references to invalid pages");
244249

245250
hash_destroy(invalid_page_tab);
246251
invalid_page_tab=NULL;

‎src/backend/utils/misc/guc.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ extern intCommitSiblings;
123123
externchar*default_tablespace;
124124
externchar*temp_tablespaces;
125125
externboolignore_checksum_failure;
126+
externboolignore_invalid_pages;
126127
externboolsynchronize_seqscans;
127128

128129
#ifdefTRACE_SYNCSCAN
@@ -1172,6 +1173,25 @@ static struct config_bool ConfigureNamesBool[] =
11721173
false,
11731174
NULL,NULL,NULL
11741175
},
1176+
{
1177+
{"ignore_invalid_pages",PGC_POSTMASTER,DEVELOPER_OPTIONS,
1178+
gettext_noop("Continues recovery after an invalid pages failure."),
1179+
gettext_noop("Detection of WAL records having references to "
1180+
"invalid pages during recovery causes PostgreSQL to "
1181+
"raise a PANIC-level error, aborting the recovery. "
1182+
"Setting ignore_invalid_pages to true causes "
1183+
"the system to ignore invalid page references "
1184+
"in WAL records (but still report a warning), "
1185+
"and continue recovery. This behavior may cause "
1186+
"crashes, data loss, propagate or hide corruption, "
1187+
"or other serious problems. Only has an effect "
1188+
"during recovery or in standby mode."),
1189+
GUC_NOT_IN_SAMPLE
1190+
},
1191+
&ignore_invalid_pages,
1192+
false,
1193+
NULL,NULL,NULL
1194+
},
11751195
{
11761196
{"full_page_writes",PGC_SIGHUP,WAL_SETTINGS,
11771197
gettext_noop("Writes full pages to WAL when first modified after a checkpoint."),

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp