On Thu, 30 Aug 2018 10:34:06 +0200 Michael Banck <michael.ba...@credativ.de> wrote:
> Hi, > > On Thu, Aug 30, 2018 at 05:35:09PM +0900, Yugo Nagata wrote: > > --- a/doc/src/sgml/ref/pg_verify_checksums.sgml > > +++ b/doc/src/sgml/ref/pg_verify_checksums.sgml > > @@ -61,11 +61,11 @@ PostgreSQL documentation > > </varlistentry> > > > > <varlistentry> > > - <term><option>-d</option></term> > > + <term><option>-v</option></term> > > Sorry that I did not catch this the first time, but as you have added > the --verbose long option, I think that should be documented here as > well, similar to -D/--pgdata. Oops, It's my mistake. I updated the patch. Thanks, > > > Michael > > -- > Michael Banck > Projektleiter / Senior Berater > Tel.: +49 2166 9901-171 > Fax: +49 2166 9901-100 > Email: michael.ba...@credativ.de > > credativ GmbH, HRB Mönchengladbach 12080 > USt-ID-Nummer: DE204566209 > Trompeterallee 108, 41189 Mönchengladbach > Geschäftsführung: Dr. Michael Meskes, Jörg Folz, Sascha Heuer > > Unser Umgang mit personenbezogenen Daten unterliegt > folgenden Bestimmungen: https://www.credativ.de/datenschutz -- Yugo Nagata <nag...@sraoss.co.jp>
>From 996622af6442934b0f363cdb6037b81164d0dc4f Mon Sep 17 00:00:00 2001 From: Yugo Nagata <nag...@sraoss.co.jp> Date: Wed, 29 Aug 2018 19:37:13 +0900 Subject: [PATCH] Raname pg_verity_checksums debug option -d to -v / verbose Also, change to only mention each scanced file not every block. --- doc/src/sgml/ref/pg_verify_checksums.sgml | 7 ++++--- .../pg_verify_checksums/pg_verify_checksums.c | 17 +++++++++-------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/doc/src/sgml/ref/pg_verify_checksums.sgml b/doc/src/sgml/ref/pg_verify_checksums.sgml index ecc5501eae..3a3433b1c8 100644 --- a/doc/src/sgml/ref/pg_verify_checksums.sgml +++ b/doc/src/sgml/ref/pg_verify_checksums.sgml @@ -61,11 +61,12 @@ PostgreSQL documentation </varlistentry> <varlistentry> - <term><option>-d</option></term> + <term><option>-v</option></term> + <term><option>--verbose</option></term> <listitem> <para> - Enable debug output. Lists all checked blocks and their checksum. - </para> + Enable verbose output. Lists all checked files. + <para> </listitem> </varlistentry> diff --git a/src/bin/pg_verify_checksums/pg_verify_checksums.c b/src/bin/pg_verify_checksums/pg_verify_checksums.c index 938b92282a..6be138eb75 100644 --- a/src/bin/pg_verify_checksums/pg_verify_checksums.c +++ b/src/bin/pg_verify_checksums/pg_verify_checksums.c @@ -31,7 +31,7 @@ static int64 badblocks = 0; static ControlFileData *ControlFile; static char *only_relfilenode = NULL; -static bool debug = false; +static bool verbose = false; static const char *progname; @@ -43,7 +43,7 @@ usage() printf(_(" %s [OPTION]... [DATADIR]\n"), progname); printf(_("\nOptions:\n")); printf(_(" [-D, --pgdata=]DATADIR data directory\n")); - printf(_(" -d debug output, list all checked blocks\n")); + printf(_(" -v, --verbose output verbose messages, list all checked files\n")); printf(_(" -r RELFILENODE check only relation with specified relfilenode\n")); printf(_(" -V, --version output version information, then exit\n")); printf(_(" -?, --help show this help, then exit\n")); @@ -120,11 +120,11 @@ scan_file(char *fn, int segmentno) progname, fn, blockno, csum, header->pd_checksum); badblocks++; } - else if (debug) - fprintf(stderr, _("%s: checksum verified in file \"%s\", block %d: %X\n"), - progname, fn, blockno, csum); } + if (verbose) + fprintf(stderr, _("%s: checksum verified in file \"%s\"\n"), progname, fn); + close(f); } @@ -208,6 +208,7 @@ main(int argc, char *argv[]) { static struct option long_options[] = { {"pgdata", required_argument, NULL, 'D'}, + {"verbose", no_argument, NULL, 'v'}, {NULL, 0, NULL, 0} }; @@ -234,12 +235,12 @@ main(int argc, char *argv[]) } } - while ((c = getopt_long(argc, argv, "D:r:d", long_options, &option_index)) != -1) + while ((c = getopt_long(argc, argv, "D:r:v", long_options, &option_index)) != -1) { switch (c) { - case 'd': - debug = true; + case 'v': + verbose = true; break; case 'D': DataDir = optarg; -- 2.17.1