Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit af99d44

Browse files
committed
pg_verifybackup: Move skip_checksums into verifier_context.
This is in preparation for adding a second source file to this directory. It will need access to this value. Also, fewer global variables is usually a good thing. Amul Sul, reviewed by Sravan Kumar and revised a bit by me. Discussion: http://postgr.es/m/CAAJ_b95mcGjkfAf1qduOR97CokW8-_i-dWLm3v6x1w2-OW9M+A@mail.gmail.com
1 parent 76dd015 commit af99d44

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/bin/pg_verifybackup/pg_verifybackup.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ typedef struct verifier_context
113113
manifest_data *manifest;
114114
char *backup_directory;
115115
SimpleStringList ignore_list;
116+
bool skip_checksums;
116117
bool exit_on_error;
117118
bool saw_any_error;
118119
} verifier_context;
@@ -162,9 +163,8 @@ static void usage(void);
162163

163164
static const char *progname;
164165

165-
/* options */
166+
/* is progress reporting enabled? */
166167
static bool show_progress = false;
167-
static bool skip_checksums = false;
168168

169169
/* Progress indicators */
170170
static uint64 total_size = 0;
@@ -266,7 +266,7 @@ main(int argc, char **argv)
266266
quiet = true;
267267
break;
268268
case 's':
269-
skip_checksums = true;
269+
context.skip_checksums = true;
270270
break;
271271
case 'w':
272272
wal_directory = pstrdup(optarg);
@@ -363,7 +363,7 @@ main(int argc, char **argv)
363363
* Now do the expensive work of verifying file checksums, unless we were
364364
* told to skip it.
365365
*/
366-
if (!skip_checksums)
366+
if (!context.skip_checksums)
367367
verify_backup_checksums(&context);
368368

369369
/*
@@ -739,7 +739,8 @@ verify_backup_file(verifier_context *context, char *relpath, char *fullpath)
739739
verify_control_file(fullpath, context->manifest->system_identifier);
740740

741741
/* Update statistics for progress report, if necessary */
742-
if (show_progress && !skip_checksums && should_verify_checksum(m))
742+
if (show_progress && !context->skip_checksums &&
743+
should_verify_checksum(m))
743744
total_size += m->size;
744745

745746
/*

0 commit comments

Comments
 (0)