v10-0004-Refactor-move-skip_checksums-global-variable-to-.patch
application/x-patch
Filename: v10-0004-Refactor-move-skip_checksums-global-variable-to-.patch
Type: application/x-patch
Part: 8
Patch
Format: format-patch
Series: patch v10-0004
Subject: Refactor: move skip_checksums global variable to verifier_context struct
| File | + | − |
|---|---|---|
| src/bin/pg_verifybackup/pg_verifybackup.c | 5 | 4 |
From bcd2f84eb984badfdaa28ad84806c8e401259f9c Mon Sep 17 00:00:00 2001 From: Amul Sul <amul.sul@enterprisedb.com> Date: Thu, 8 Aug 2024 15:10:43 +0530 Subject: [PATCH v10 04/12] Refactor: move skip_checksums global variable to verifier_context struct To enable access to this flag in another file. --- src/bin/pg_verifybackup/pg_verifybackup.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/bin/pg_verifybackup/pg_verifybackup.c b/src/bin/pg_verifybackup/pg_verifybackup.c index d77e70fbe38..c6d01d52335 100644 --- a/src/bin/pg_verifybackup/pg_verifybackup.c +++ b/src/bin/pg_verifybackup/pg_verifybackup.c @@ -113,6 +113,7 @@ typedef struct verifier_context manifest_data *manifest; char *backup_directory; SimpleStringList ignore_list; + bool skip_checksums; bool exit_on_error; bool saw_any_error; } verifier_context; @@ -164,7 +165,6 @@ static const char *progname; /* options */ static bool show_progress = false; -static bool skip_checksums = false; /* Progress indicators */ static uint64 total_size = 0; @@ -266,7 +266,7 @@ main(int argc, char **argv) quiet = true; break; case 's': - skip_checksums = true; + context.skip_checksums = true; break; case 'w': wal_directory = pstrdup(optarg); @@ -363,7 +363,7 @@ main(int argc, char **argv) * Now do the expensive work of verifying file checksums, unless we were * told to skip it. */ - if (!skip_checksums) + if (!context.skip_checksums) verify_backup_checksums(&context); /* @@ -739,7 +739,8 @@ verify_backup_file(verifier_context *context, char *relpath, char *fullpath) verify_control_file(fullpath, context->manifest->system_identifier); /* Update statistics for progress report, if necessary */ - if (show_progress && !skip_checksums && should_verify_checksum(m)) + if (show_progress && !context->skip_checksums && + should_verify_checksum(m)) total_size += m->size; /* -- 2.18.0