Commit 6dd263cf authored by Michael Paquier's avatar Michael Paquier

Rename pg_verify_checksums to pg_checksums

The current tool name is too restrictive and focuses only on verifying
checksums.  As more options to control checksums for an offline cluster
are planned to be added, switch to a more generic name.  Documentation
as well as all past references to the tool are updated.

Author: Michael Paquier
Reviewed-by: Michael Banck, Fabien Coelho, Seigei Kornilov
Discussion: https://postgr.es/m/20181221201616.GD4974@nighthawk.caipicrew.dd-dns.de
parent c9ae7f70
...@@ -199,6 +199,7 @@ Complete list of usable sgml source files in this directory. ...@@ -199,6 +199,7 @@ Complete list of usable sgml source files in this directory.
<!ENTITY pgarchivecleanup SYSTEM "pgarchivecleanup.sgml"> <!ENTITY pgarchivecleanup SYSTEM "pgarchivecleanup.sgml">
<!ENTITY pgBasebackup SYSTEM "pg_basebackup.sgml"> <!ENTITY pgBasebackup SYSTEM "pg_basebackup.sgml">
<!ENTITY pgbench SYSTEM "pgbench.sgml"> <!ENTITY pgbench SYSTEM "pgbench.sgml">
<!ENTITY pgChecksums SYSTEM "pg_checksums.sgml">
<!ENTITY pgConfig SYSTEM "pg_config-ref.sgml"> <!ENTITY pgConfig SYSTEM "pg_config-ref.sgml">
<!ENTITY pgControldata SYSTEM "pg_controldata.sgml"> <!ENTITY pgControldata SYSTEM "pg_controldata.sgml">
<!ENTITY pgCtl SYSTEM "pg_ctl-ref.sgml"> <!ENTITY pgCtl SYSTEM "pg_ctl-ref.sgml">
...@@ -210,7 +211,6 @@ Complete list of usable sgml source files in this directory. ...@@ -210,7 +211,6 @@ Complete list of usable sgml source files in this directory.
<!ENTITY pgResetwal SYSTEM "pg_resetwal.sgml"> <!ENTITY pgResetwal SYSTEM "pg_resetwal.sgml">
<!ENTITY pgRestore SYSTEM "pg_restore.sgml"> <!ENTITY pgRestore SYSTEM "pg_restore.sgml">
<!ENTITY pgRewind SYSTEM "pg_rewind.sgml"> <!ENTITY pgRewind SYSTEM "pg_rewind.sgml">
<!ENTITY pgVerifyChecksums SYSTEM "pg_verify_checksums.sgml">
<!ENTITY pgtestfsync SYSTEM "pgtestfsync.sgml"> <!ENTITY pgtestfsync SYSTEM "pgtestfsync.sgml">
<!ENTITY pgtesttiming SYSTEM "pgtesttiming.sgml"> <!ENTITY pgtesttiming SYSTEM "pgtesttiming.sgml">
<!ENTITY pgupgrade SYSTEM "pgupgrade.sgml"> <!ENTITY pgupgrade SYSTEM "pgupgrade.sgml">
......
<!-- <!--
doc/src/sgml/ref/pg_verify_checksums.sgml doc/src/sgml/ref/pg_checksums.sgml
PostgreSQL documentation PostgreSQL documentation
--> -->
<refentry id="pgverifychecksums"> <refentry id="app-pgchecksums">
<indexterm zone="pgverifychecksums"> <indexterm zone="app-pgchecksums">
<primary>pg_verify_checksums</primary> <primary>pg_checksums</primary>
</indexterm> </indexterm>
<refmeta> <refmeta>
<refentrytitle><application>pg_verify_checksums</application></refentrytitle> <refentrytitle><application>pg_checksums</application></refentrytitle>
<manvolnum>1</manvolnum> <manvolnum>1</manvolnum>
<refmiscinfo>Application</refmiscinfo> <refmiscinfo>Application</refmiscinfo>
</refmeta> </refmeta>
<refnamediv> <refnamediv>
<refname>pg_verify_checksums</refname> <refname>pg_checksums</refname>
<refpurpose>verify data checksums in a <productname>PostgreSQL</productname> database cluster</refpurpose> <refpurpose>verify data checksums in a <productname>PostgreSQL</productname> database cluster</refpurpose>
</refnamediv> </refnamediv>
<refsynopsisdiv> <refsynopsisdiv>
<cmdsynopsis> <cmdsynopsis>
<command>pg_verify_checksums</command> <command>pg_checksums</command>
<arg rep="repeat" choice="opt"><replaceable class="parameter">option</replaceable></arg> <arg rep="repeat" choice="opt"><replaceable class="parameter">option</replaceable></arg>
<group choice="opt"> <group choice="opt">
<group choice="opt"> <group choice="opt">
...@@ -33,12 +33,12 @@ PostgreSQL documentation ...@@ -33,12 +33,12 @@ PostgreSQL documentation
</cmdsynopsis> </cmdsynopsis>
</refsynopsisdiv> </refsynopsisdiv>
<refsect1 id="r1-app-pg_verify_checksums-1"> <refsect1 id="r1-app-pg_checksums-1">
<title>Description</title> <title>Description</title>
<para> <para>
<command>pg_verify_checksums</command> verifies data checksums in a <application>pg_checksums</application> verifies data checksums in a
<productname>PostgreSQL</productname> cluster. The server must be shut <productname>PostgreSQL</productname> cluster. The server must be shut
down cleanly before running <application>pg_verify_checksums</application>. down cleanly before running <application>pg_checksums</application>.
The exit status is zero if there are no checksum errors, otherwise nonzero. The exit status is zero if there are no checksum errors, otherwise nonzero.
</para> </para>
</refsect1> </refsect1>
...@@ -84,7 +84,7 @@ PostgreSQL documentation ...@@ -84,7 +84,7 @@ PostgreSQL documentation
<term><option>--version</option></term> <term><option>--version</option></term>
<listitem> <listitem>
<para> <para>
Print the <application>pg_verify_checksums</application> version and exit. Print the <application>pg_checksums</application> version and exit.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
...@@ -94,7 +94,7 @@ PostgreSQL documentation ...@@ -94,7 +94,7 @@ PostgreSQL documentation
<term><option>--help</option></term> <term><option>--help</option></term>
<listitem> <listitem>
<para> <para>
Show help about <application>pg_verify_checksums</application> command line Show help about <application>pg_checksums</application> command line
arguments, and exit. arguments, and exit.
</para> </para>
</listitem> </listitem>
......
...@@ -276,6 +276,7 @@ ...@@ -276,6 +276,7 @@
&initdb; &initdb;
&pgarchivecleanup; &pgarchivecleanup;
&pgChecksums;
&pgControldata; &pgControldata;
&pgCtl; &pgCtl;
&pgResetwal; &pgResetwal;
...@@ -283,7 +284,6 @@ ...@@ -283,7 +284,6 @@
&pgtestfsync; &pgtestfsync;
&pgtesttiming; &pgtesttiming;
&pgupgrade; &pgupgrade;
&pgVerifyChecksums;
&pgwaldump; &pgwaldump;
&postgres; &postgres;
&postmaster; &postmaster;
......
...@@ -190,7 +190,7 @@ static const char *excludeFiles[] = ...@@ -190,7 +190,7 @@ static const char *excludeFiles[] =
/* /*
* List of files excluded from checksum validation. * List of files excluded from checksum validation.
* *
* Note: this list should be kept in sync with what pg_verify_checksums.c * Note: this list should be kept in sync with what pg_checksums.c
* includes. * includes.
*/ */
static const char *const noChecksumFiles[] = { static const char *const noChecksumFiles[] = {
......
...@@ -17,6 +17,7 @@ SUBDIRS = \ ...@@ -17,6 +17,7 @@ SUBDIRS = \
initdb \ initdb \
pg_archivecleanup \ pg_archivecleanup \
pg_basebackup \ pg_basebackup \
pg_checksums \
pg_config \ pg_config \
pg_controldata \ pg_controldata \
pg_ctl \ pg_ctl \
...@@ -26,7 +27,6 @@ SUBDIRS = \ ...@@ -26,7 +27,6 @@ SUBDIRS = \
pg_test_fsync \ pg_test_fsync \
pg_test_timing \ pg_test_timing \
pg_upgrade \ pg_upgrade \
pg_verify_checksums \
pg_waldump \ pg_waldump \
pgbench \ pgbench \
psql \ psql \
......
...@@ -63,12 +63,12 @@ mkdir $datadir; ...@@ -63,12 +63,12 @@ mkdir $datadir;
command_like(['pg_controldata', $datadir], command_like(['pg_controldata', $datadir],
qr/Data page checksum version:.*0/, qr/Data page checksum version:.*0/,
'checksums are disabled in control file'); 'checksums are disabled in control file');
# pg_verify_checksums fails with checksums disabled by default. This is # pg_checksums fails with checksums disabled by default. This is
# not part of the tests included in pg_verify_checksums to save from # not part of the tests included in pg_checksums to save from
# the creation of an extra instance. # the creation of an extra instance.
command_fails( command_fails(
[ 'pg_verify_checksums', '-D', $datadir], [ 'pg_checksums', '-D', $datadir],
"pg_verify_checksums fails with data checksum disabled"); "pg_checksums fails with data checksum disabled");
command_ok([ 'initdb', '-S', $datadir ], 'sync only'); command_ok([ 'initdb', '-S', $datadir ], 'sync only');
command_fails([ 'initdb', $datadir ], 'existing data directory'); command_fails([ 'initdb', $datadir ], 'existing data directory');
......
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
# Makefile for src/bin/pg_verify_checksums # Makefile for src/bin/pg_checksums
# #
# Copyright (c) 1998-2019, PostgreSQL Global Development Group # Copyright (c) 1998-2019, PostgreSQL Global Development Group
# #
# src/bin/pg_verify_checksums/Makefile # src/bin/pg_checksums/Makefile
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
PGFILEDESC = "pg_verify_checksums - verify data checksums in an offline cluster" PGFILEDESC = "pg_checksums - verify data checksums in an offline cluster"
PGAPPICON=win32 PGAPPICON=win32
subdir = src/bin/pg_verify_checksums subdir = src/bin/pg_checksums
top_builddir = ../../.. top_builddir = ../../..
include $(top_builddir)/src/Makefile.global include $(top_builddir)/src/Makefile.global
OBJS= pg_verify_checksums.o $(WIN32RES) OBJS= pg_checksums.o $(WIN32RES)
all: pg_verify_checksums all: pg_checksums
pg_verify_checksums: $(OBJS) | submake-libpgport pg_checksums: $(OBJS) | submake-libpgport
$(CC) $(CFLAGS) $^ $(LDFLAGS) $(LDFLAGS_EX) $(LIBS) -o $@$(X) $(CC) $(CFLAGS) $^ $(LDFLAGS) $(LDFLAGS_EX) $(LIBS) -o $@$(X)
install: all installdirs install: all installdirs
$(INSTALL_PROGRAM) pg_verify_checksums$(X) '$(DESTDIR)$(bindir)/pg_verify_checksums$(X)' $(INSTALL_PROGRAM) pg_checksums$(X) '$(DESTDIR)$(bindir)/pg_checksums$(X)'
installdirs: installdirs:
$(MKDIR_P) '$(DESTDIR)$(bindir)' $(MKDIR_P) '$(DESTDIR)$(bindir)'
uninstall: uninstall:
rm -f '$(DESTDIR)$(bindir)/pg_verify_checksums$(X)' rm -f '$(DESTDIR)$(bindir)/pg_checksums$(X)'
clean distclean maintainer-clean: clean distclean maintainer-clean:
rm -f pg_verify_checksums$(X) $(OBJS) rm -f pg_checksums$(X) $(OBJS)
rm -rf tmp_check rm -rf tmp_check
check: check:
......
# src/bin/pg_checksums/nls.mk
CATALOG_NAME = pg_checksums
AVAIL_LANGUAGES =
GETTEXT_FILES = pg_checksums.c
/* /*-------------------------------------------------------------------------
* pg_verify_checksums
* *
* Verifies page level checksums in an offline cluster * pg_checksums.c
* Verifies page level checksums in an offline cluster.
* *
* Copyright (c) 2010-2019, PostgreSQL Global Development Group * Copyright (c) 2010-2019, PostgreSQL Global Development Group
* *
* src/bin/pg_verify_checksums/pg_verify_checksums.c * IDENTIFICATION
* src/bin/pg_checksums/pg_checksums.c
*
*-------------------------------------------------------------------------
*/ */
#include "postgres_fe.h" #include "postgres_fe.h"
#include <dirent.h> #include <dirent.h>
...@@ -240,7 +244,7 @@ main(int argc, char *argv[]) ...@@ -240,7 +244,7 @@ main(int argc, char *argv[])
int option_index; int option_index;
bool crc_ok; bool crc_ok;
set_pglocale_pgservice(argv[0], PG_TEXTDOMAIN("pg_verify_checksums")); set_pglocale_pgservice(argv[0], PG_TEXTDOMAIN("pg_checksums"));
progname = get_progname(argv[0]); progname = get_progname(argv[0]);
...@@ -253,7 +257,7 @@ main(int argc, char *argv[]) ...@@ -253,7 +257,7 @@ main(int argc, char *argv[])
} }
if (strcmp(argv[1], "--version") == 0 || strcmp(argv[1], "-V") == 0) if (strcmp(argv[1], "--version") == 0 || strcmp(argv[1], "-V") == 0)
{ {
puts("pg_verify_checksums (PostgreSQL) " PG_VERSION); puts("pg_checksums (PostgreSQL) " PG_VERSION);
exit(0); exit(0);
} }
} }
...@@ -318,7 +322,7 @@ main(int argc, char *argv[]) ...@@ -318,7 +322,7 @@ main(int argc, char *argv[])
if (ControlFile->pg_control_version != PG_CONTROL_VERSION) if (ControlFile->pg_control_version != PG_CONTROL_VERSION)
{ {
fprintf(stderr, _("%s: cluster is not compatible with this version of pg_verify_checksums\n"), fprintf(stderr, _("%s: cluster is not compatible with this version of pg_checksums\n"),
progname); progname);
exit(1); exit(1);
} }
......
...@@ -3,6 +3,6 @@ use warnings; ...@@ -3,6 +3,6 @@ use warnings;
use TestLib; use TestLib;
use Test::More tests => 8; use Test::More tests => 8;
program_help_ok('pg_verify_checksums'); program_help_ok('pg_checksums');
program_version_ok('pg_verify_checksums'); program_version_ok('pg_checksums');
program_options_handling_ok('pg_verify_checksums'); program_options_handling_ok('pg_checksums');
# Do basic sanity checks supported by pg_verify_checksums using # Do basic sanity checks supported by pg_checksums using
# an initialized cluster. # an initialized cluster.
use strict; use strict;
...@@ -38,7 +38,7 @@ sub check_relation_corruption ...@@ -38,7 +38,7 @@ sub check_relation_corruption
# Checksums are correct for single relfilenode as the table is not # Checksums are correct for single relfilenode as the table is not
# corrupted yet. # corrupted yet.
command_ok(['pg_verify_checksums', '-D', $pgdata, command_ok(['pg_checksums', '-D', $pgdata,
'-r', $relfilenode_corrupted], '-r', $relfilenode_corrupted],
"succeeds for single relfilenode on tablespace $tablespace with offline cluster"); "succeeds for single relfilenode on tablespace $tablespace with offline cluster");
...@@ -49,7 +49,7 @@ sub check_relation_corruption ...@@ -49,7 +49,7 @@ sub check_relation_corruption
close $file; close $file;
# Checksum checks on single relfilenode fail # Checksum checks on single relfilenode fail
$node->command_checks_all([ 'pg_verify_checksums', '-D', $pgdata, '-r', $node->command_checks_all([ 'pg_checksums', '-D', $pgdata, '-r',
$relfilenode_corrupted], $relfilenode_corrupted],
1, 1,
[qr/Bad checksums:.*1/], [qr/Bad checksums:.*1/],
...@@ -57,7 +57,7 @@ sub check_relation_corruption ...@@ -57,7 +57,7 @@ sub check_relation_corruption
"fails with corrupted data for single relfilenode on tablespace $tablespace"); "fails with corrupted data for single relfilenode on tablespace $tablespace");
# Global checksum checks fail as well # Global checksum checks fail as well
$node->command_checks_all([ 'pg_verify_checksums', '-D', $pgdata], $node->command_checks_all([ 'pg_checksums', '-D', $pgdata],
1, 1,
[qr/Bad checksums:.*1/], [qr/Bad checksums:.*1/],
[qr/checksum verification failed/], [qr/checksum verification failed/],
...@@ -67,7 +67,7 @@ sub check_relation_corruption ...@@ -67,7 +67,7 @@ sub check_relation_corruption
$node->start; $node->start;
$node->safe_psql('postgres', "DROP TABLE $table;"); $node->safe_psql('postgres', "DROP TABLE $table;");
$node->stop; $node->stop;
$node->command_ok(['pg_verify_checksums', '-D', $pgdata], $node->command_ok(['pg_checksums', '-D', $pgdata],
"succeeds again after table drop on tablespace $tablespace"); "succeeds again after table drop on tablespace $tablespace");
$node->start; $node->start;
...@@ -101,12 +101,12 @@ mkdir "$pgdata/global/pgsql_tmp"; ...@@ -101,12 +101,12 @@ mkdir "$pgdata/global/pgsql_tmp";
append_to_file "$pgdata/global/pgsql_tmp/1.1", "foo"; append_to_file "$pgdata/global/pgsql_tmp/1.1", "foo";
# Checksums pass on a newly-created cluster # Checksums pass on a newly-created cluster
command_ok(['pg_verify_checksums', '-D', $pgdata], command_ok(['pg_checksums', '-D', $pgdata],
"succeeds with offline cluster"); "succeeds with offline cluster");
# Checks cannot happen with an online cluster # Checks cannot happen with an online cluster
$node->start; $node->start;
command_fails(['pg_verify_checksums', '-D', $pgdata], command_fails(['pg_checksums', '-D', $pgdata],
"fails with online cluster"); "fails with online cluster");
# Check corruption of table on default tablespace. # Check corruption of table on default tablespace.
...@@ -121,7 +121,7 @@ $node->safe_psql('postgres', ...@@ -121,7 +121,7 @@ $node->safe_psql('postgres',
"CREATE TABLESPACE ts_corrupt LOCATION '$tablespace_dir';"); "CREATE TABLESPACE ts_corrupt LOCATION '$tablespace_dir';");
check_relation_corruption($node, 'corrupt2', 'ts_corrupt'); check_relation_corruption($node, 'corrupt2', 'ts_corrupt');
# Utility routine to check that pg_verify_checksums is able to detect # Utility routine to check that pg_checksums is able to detect
# correctly-named relation files filled with some corrupted data. # correctly-named relation files filled with some corrupted data.
sub fail_corrupt sub fail_corrupt
{ {
...@@ -133,7 +133,7 @@ sub fail_corrupt ...@@ -133,7 +133,7 @@ sub fail_corrupt
my $file_name = "$pgdata/global/$file"; my $file_name = "$pgdata/global/$file";
append_to_file $file_name, "foo"; append_to_file $file_name, "foo";
$node->command_checks_all([ 'pg_verify_checksums', '-D', $pgdata], $node->command_checks_all([ 'pg_checksums', '-D', $pgdata],
1, 1,
[qr/^$/], [qr/^$/],
[qr/could not read block 0 in file.*$file\":/], [qr/could not read block 0 in file.*$file\":/],
......
# src/bin/pg_verify_checksums/nls.mk
CATALOG_NAME = pg_verify_checksums
AVAIL_LANGUAGES =
GETTEXT_FILES = pg_verify_checksums.c
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment