Skip to content

Commit cf621d9

Browse files
committed
Add documentation chapter about checksums
Data checksums did not have a longer discussion in the docs, this adds a short section with an overview. Extracted from the larger patch for on-line enabling of checksums, which has many more authors and reviewers. Author: Daniel Gustafsson Reviewed-By: Magnus Hagander, Michael Banck (and others through the big patch) Discussion: https://postgr.es/m/[email protected]
1 parent 1db0d17 commit cf621d9

File tree

3 files changed

+51
-3
lines changed

3 files changed

+51
-3
lines changed

doc/src/sgml/amcheck.sgml

+2-2
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ SET client_min_messages = DEBUG1;
393393
<para>
394394
<filename>amcheck</filename> can be effective at detecting various types of
395395
failure modes that <link
396-
linkend="app-initdb-data-checksums"><application>data page
396+
linkend="app-initdb-data-checksums"><application>data
397397
checksums</application></link> will fail to catch. These include:
398398

399399
<itemizedlist>
@@ -497,7 +497,7 @@ SET client_min_messages = DEBUG1;
497497
Structural corruption can happen due to faulty storage hardware, or
498498
relation files being overwritten or modified by unrelated software.
499499
This kind of corruption can also be detected with
500-
<link linkend="app-initdb-data-checksums"><application>data page
500+
<link linkend="checksums"><application>data page
501501
checksums</application></link>.
502502
</para>
503503

doc/src/sgml/ref/initdb.sgml

+1
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,7 @@ PostgreSQL documentation
219219
failures will be reported in the
220220
<link linkend="monitoring-pg-stat-database-view">
221221
<structname>pg_stat_database</structname></link> view.
222+
See <xref linkend="checksums" /> for details.
222223
</para>
223224
</listitem>
224225
</varlistentry>

doc/src/sgml/wal.sgml

+48-1
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@
196196
Data pages are not currently checksummed by default, though full page images
197197
recorded in WAL records will be protected; see <link
198198
linkend="app-initdb-data-checksums"><application>initdb</application></link>
199-
for details about enabling data page checksums.
199+
for details about enabling data checksums.
200200
</para>
201201
</listitem>
202202
<listitem>
@@ -230,6 +230,53 @@
230230
</para>
231231
</sect1>
232232

233+
<sect1 id="checksums">
234+
<title>Data Checksums</title>
235+
<indexterm>
236+
<primary>checksums</primary>
237+
</indexterm>
238+
239+
<para>
240+
Data pages are not checksum protected by default, but this can optionally be
241+
enabled for a cluster. When enabled, each data page will be assigned a
242+
checksum that is updated when the page is written and verified every time
243+
the page is read. Only data pages are protected by checksums, internal data
244+
structures and temporary files are not.
245+
</para>
246+
247+
<para>
248+
Checksums are normally enabled when the cluster is initialized using <link
249+
linkend="app-initdb-data-checksums"><application>initdb</application></link>.
250+
They can also be enabled or disabled at a later time as an offline
251+
operation. Data checksums are enabled or disabled at the full cluster
252+
level, and cannot be specified individually for databases or tables.
253+
</para>
254+
255+
<para>
256+
The current state of checksums in the cluster can be verified by viewing the
257+
value of the read-only configuration variable <xref
258+
linkend="guc-data-checksums" /> by issuing the command <command>SHOW
259+
data_checksums</command>.
260+
</para>
261+
262+
<para>
263+
When attempting to recover from corrupt data it may be necessary to bypass
264+
the checksum protection in order to recover data. To do this, temporarily
265+
set the configuration parameter <xref linkend="guc-ignore-checksum-failure" />.
266+
</para>
267+
268+
<sect2 id="checksums-offline-enable-disable">
269+
<title>Off-line Enabling of Checksums</title>
270+
271+
<para>
272+
The <link linkend="app-pgchecksums"><application>pg_checksums</application></link>
273+
application can be used to enable or disable data checksums, as well as
274+
verify checksums, on an offline cluster.
275+
</para>
276+
277+
</sect2>
278+
</sect1>
279+
233280
<sect1 id="wal-intro">
234281
<title>Write-Ahead Logging (<acronym>WAL</acronym>)</title>
235282

0 commit comments

Comments
 (0)