]> granicus.if.org Git - postgresql/commitdiff
pg_verify_checksums: rename -d to --verbose
authorAlvaro Herrera <alvherre@alvh.no-ip.org>
Thu, 30 Aug 2018 09:31:05 +0000 (06:31 -0300)
committerAlvaro Herrera <alvherre@alvh.no-ip.org>
Thu, 30 Aug 2018 09:35:55 +0000 (06:35 -0300)
Using -d is odd, because we normally reserve that for a database
argument, so rename it to -v and add long version --verbose.

Also, reduce it to emit one line per file checked rather than one line
per block.

Per a complaint from Michael Banck.

Author: Yugo Nagata <nagata@sraoss.co.jp>
Reviewed-by: Michael Banck <michael.banck@credativ.de>
Discussion: https://postgr.es/m/20180827113411.GA22768@nighthawk.caipicrew.dd-dns.de

doc/src/sgml/ref/pg_verify_checksums.sgml
src/bin/pg_verify_checksums/pg_verify_checksums.c

index ecc5501eaec60246160969edbcceea90bcafe0b6..905b8f12225f3e57eae6732aaa5b35028f8e9fde 100644 (file)
@@ -61,10 +61,11 @@ 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.
+        Enable verbose output. Lists all checked files.
        </para>
       </listitem>
      </varlistentry>
index 938b92282a7f3fa99621f7306b32478ddda8e015..a941236563645eed5503eaaf2770ed2f5bdc0fe3 100644 (file)
@@ -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\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,12 @@ 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: checksums verified in file \"%s\"\n"), progname, fn);
+
        close(f);
 }
 
@@ -208,6 +209,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 +236,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;