1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-27 12:41:57 +03:00

Add WAL consistency checking facility.

When the new GUC wal_consistency_checking is set to a non-empty value,
it triggers recording of additional full-page images, which are
compared on the standby against the results of applying the WAL record
(without regard to those full-page images).  Allowable differences
such as hints are masked out, and the resulting pages are compared;
any difference results in a FATAL error on the standby.

Kuntal Ghosh, based on earlier patches by Michael Paquier and Heikki
Linnakangas.  Extensively reviewed and revised by Michael Paquier and
by me, with additional reviews and comments from Amit Kapila, Álvaro
Herrera, Simon Riggs, and Peter Eisentraut.
This commit is contained in:
Robert Haas
2017-02-08 15:45:30 -05:00
parent 115cb31597
commit a507b86900
36 changed files with 811 additions and 48 deletions

View File

@ -8184,6 +8184,38 @@ LOG: CleanUpLock: deleting: lock(0xb7acd844) id(24688,24696,0,0,0,1)
</listitem>
</varlistentry>
<varlistentry id="guc-wal-consistency-checking" xreflabel="wal_consistency_checking">
<term><varname>wal_consistency_checking</varname> (<type>string</type>)
<indexterm>
<primary><varname>wal_consistency_checking</> configuration parameter</primary>
</indexterm>
</term>
<listitem>
<para>
This parameter is intended to be used to check for bugs in the WAL
redo routines. When enabled, full-page images of any buffers modified
in conjunction with the WAL record are added to the record.
If the record is subsequently replayed, the system will first apply
each record and then test whether the buffers modified by the record
match the stored images. In certain cases (such as hint bits), minor
variations are acceptable, and will be ignored. Any unexpected
differences will result in a fatal error, terminating recovery.
</para>
<para>
The default value of this setting is the empty string, which disables
the feature. It can be set to <literal>all</literal> to check all
records, or to a comma-separated list of resource managers to check
only records originating from those resource managers. Currently,
the supported resource managers are <literal>heap</>,
<literal>heap2</>, <literal>btree</>, <literal>gin</>,
<literal>gist</>, <literal>sequence</>, <literal>spgist</>,
<literal>brin</>, and <literal>generic</>. Only
superusers can change this setting.
</para>
</listitem>
</varlistentry>
<varlistentry id="guc-wal-debug" xreflabel="wal_debug">
<term><varname>wal_debug</varname> (<type>boolean</type>)
<indexterm>