Skip to content

Commit a846e6d

Browse files
committed
pg_verify_checksums: rename -d to --verbose
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
1 parent 4db226b commit a846e6d

File tree

2 files changed

+13
-10
lines changed

2 files changed

+13
-10
lines changed

doc/src/sgml/ref/pg_verify_checksums.sgml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,11 @@ PostgreSQL documentation
6161
</varlistentry>
6262

6363
<varlistentry>
64-
<term><option>-d</option></term>
64+
<term><option>-v</option></term>
65+
<term><option>--verbose</option></term>
6566
<listitem>
6667
<para>
67-
Enable debug output. Lists all checked blocks and their checksum.
68+
Enable verbose output. Lists all checked files.
6869
</para>
6970
</listitem>
7071
</varlistentry>

src/bin/pg_verify_checksums/pg_verify_checksums.c

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ static int64 badblocks = 0;
3131
static ControlFileData *ControlFile;
3232

3333
static char *only_relfilenode = NULL;
34-
static bool debug = false;
34+
static bool verbose = false;
3535

3636
static const char *progname;
3737

@@ -43,7 +43,7 @@ usage()
4343
printf(_(" %s [OPTION]... [DATADIR]\n"), progname);
4444
printf(_("\nOptions:\n"));
4545
printf(_(" [-D, --pgdata=]DATADIR data directory\n"));
46-
printf(_(" -d debug output, list all checked blocks\n"));
46+
printf(_(" -v, --verbose output verbose messages\n"));
4747
printf(_(" -r RELFILENODE check only relation with specified relfilenode\n"));
4848
printf(_(" -V, --version output version information, then exit\n"));
4949
printf(_(" -?, --help show this help, then exit\n"));
@@ -120,11 +120,12 @@ scan_file(char *fn, int segmentno)
120120
progname, fn, blockno, csum, header->pd_checksum);
121121
badblocks++;
122122
}
123-
else if (debug)
124-
fprintf(stderr, _("%s: checksum verified in file \"%s\", block %d: %X\n"),
125-
progname, fn, blockno, csum);
126123
}
127124

125+
if (verbose)
126+
fprintf(stderr,
127+
_("%s: checksums verified in file \"%s\"\n"), progname, fn);
128+
128129
close(f);
129130
}
130131

@@ -208,6 +209,7 @@ main(int argc, char *argv[])
208209
{
209210
static struct option long_options[] = {
210211
{"pgdata", required_argument, NULL, 'D'},
212+
{"verbose", no_argument, NULL, 'v'},
211213
{NULL, 0, NULL, 0}
212214
};
213215

@@ -234,12 +236,12 @@ main(int argc, char *argv[])
234236
}
235237
}
236238

237-
while ((c = getopt_long(argc, argv, "D:r:d", long_options, &option_index)) != -1)
239+
while ((c = getopt_long(argc, argv, "D:r:v", long_options, &option_index)) != -1)
238240
{
239241
switch (c)
240242
{
241-
case 'd':
242-
debug = true;
243+
case 'v':
244+
verbose = true;
243245
break;
244246
case 'D':
245247
DataDir = optarg;

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy