aboutsummaryrefslogtreecommitdiff
path: root/doc/src
diff options
context:
space:
mode:
authorMichael Paquier <michael@paquier.xyz>2019-03-23 08:12:55 +0900
committerMichael Paquier <michael@paquier.xyz>2019-03-23 08:12:55 +0900
commited308d78379008b2cebca30a986f97f992ee6122 (patch)
tree4bbff996d7d61796a6797c89033f656a4b944a7c /doc/src
parent87914e708aabb7e2cd9045fa95b4fed99ca458ec (diff)
downloadpostgresql-ed308d78379008b2cebca30a986f97f992ee6122.tar.gz
postgresql-ed308d78379008b2cebca30a986f97f992ee6122.zip
Add options to enable and disable checksums in pg_checksums
An offline cluster can now work with more modes in pg_checksums: - --enable enables checksums in a cluster, updating all blocks with a correct checksum, and updating the control file at the end. - --disable disables checksums in a cluster, updating only the control file. - --check is an extra option able to verify checksums for a cluster, and the default used if no mode is specified. When running --enable or --disable, the data folder gets fsync'd for durability, and then it is followed by a control file update and flush to keep the operation consistent should the tool be interrupted, killed or the host unplugged. If no mode is specified in the options, then --check is used for compatibility with older versions of pg_checksums (named pg_verify_checksums in v11 where it was introduced). Author: Michael Banck, Michael Paquier Reviewed-by: Fabien Coelho, Magnus Hagander, Sergei Kornilov Discussion: https://postgr.es/m/20181221201616.GD4974@nighthawk.caipicrew.dd-dns.de
Diffstat (limited to 'doc/src')
-rw-r--r--doc/src/sgml/ref/pg_checksums.sgml79
1 files changed, 74 insertions, 5 deletions
diff --git a/doc/src/sgml/ref/pg_checksums.sgml b/doc/src/sgml/ref/pg_checksums.sgml
index 6a47dda6837..5343a8aa7e8 100644
--- a/doc/src/sgml/ref/pg_checksums.sgml
+++ b/doc/src/sgml/ref/pg_checksums.sgml
@@ -16,7 +16,7 @@ PostgreSQL documentation
<refnamediv>
<refname>pg_checksums</refname>
- <refpurpose>verify data checksums in a <productname>PostgreSQL</productname> database cluster</refpurpose>
+ <refpurpose>enable, disable or check data checksums in a <productname>PostgreSQL</productname> database cluster</refpurpose>
</refnamediv>
<refsynopsisdiv>
@@ -36,10 +36,19 @@ PostgreSQL documentation
<refsect1 id="r1-app-pg_checksums-1">
<title>Description</title>
<para>
- <application>pg_checksums</application> verifies data checksums in a
- <productname>PostgreSQL</productname> cluster. The server must be shut
- down cleanly before running <application>pg_checksums</application>.
- The exit status is zero if there are no checksum errors, otherwise nonzero.
+ <application>pg_checksums</application> checks, enables or disables data
+ checksums in a <productname>PostgreSQL</productname> cluster. The server
+ must be shut down cleanly before running
+ <application>pg_checksums</application>. The exit status is zero if there
+ are no checksum errors when checking them, and nonzero if at least one
+ checksum failure is detected. If enabling or disabling checksums, the
+ exit status is nonzero if the operation failed.
+ </para>
+
+ <para>
+ While checking or enabling checksums needs to scan or write every file in
+ the cluster, disabling checksums will only update the file
+ <filename>pg_control</filename>.
</para>
</refsect1>
@@ -61,6 +70,37 @@ PostgreSQL documentation
</varlistentry>
<varlistentry>
+ <term><option>-c</option></term>
+ <term><option>--check</option></term>
+ <listitem>
+ <para>
+ Checks checksums. This is the default mode if nothing else is
+ specified.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-d</option></term>
+ <term><option>--disable</option></term>
+ <listitem>
+ <para>
+ Disables checksums.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-e</option></term>
+ <term><option>--enable</option></term>
+ <listitem>
+ <para>
+ Enables checksums.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
<term><option>-v</option></term>
<term><option>--verbose</option></term>
<listitem>
@@ -119,4 +159,33 @@ PostgreSQL documentation
</varlistentry>
</variablelist>
</refsect1>
+
+ <refsect1>
+ <title>Notes</title>
+ <para>
+ When disabling or enabling checksums in a replication setup of multiple
+ clusters, it is recommended to stop all the clusters before doing
+ the switch to all the clusters consistently. When using a replication
+ setup with tools which perform direct copies of relation file blocks
+ (for example <xref linkend="app-pgrewind"/>), enabling or disabling
+ checksums can lead to page corruptions in the shape of incorrect
+ checksums if the operation is not done consistently across all nodes.
+ Destroying all the standbys in the setup first, enabling or disabling
+ checksums on the primary and finally recreating the standbys from
+ scratch is also safe.
+ </para>
+ <para>
+ If <application>pg_checksums</application> is aborted or killed in
+ its operation while enabling or disabling checksums, the cluster
+ will have the same state with respect of checksums as before the
+ operation and <application>pg_checksums</application> needs to be
+ restarted.
+ </para>
+ <para>
+ When enabling checksums in a cluster, the operation can potentially
+ take a long time if the data directory is large. During this operation,
+ the cluster or other programs that write to the data directory must not
+ be started or else data loss may occur.
+ </para>
+ </refsect1>
</refentry>