v5-0009-Refactor-move-first-and-last-progress_report-call.patch

application/x-patch

Filename: v5-0009-Refactor-move-first-and-last-progress_report-call.patch
Type: application/x-patch
Part: 3
Message: Re: pg_verifybackup: TAR format backup verification

Patch

Format: format-patch
Series: patch v5-0009
Subject: Refactor: move first and last progress_report call to Main.
File+
src/bin/pg_verifybackup/pg_verifybackup.c 6 4
From 498ee467c0123d816d14717c20746e55b26d974f Mon Sep 17 00:00:00 2001
From: Amul Sul <amul.sul@enterprisedb.com>
Date: Fri, 2 Aug 2024 16:37:38 +0530
Subject: [PATCH v5 09/12] Refactor: move first and last progress_report call
 to Main.

---
 src/bin/pg_verifybackup/pg_verifybackup.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/bin/pg_verifybackup/pg_verifybackup.c b/src/bin/pg_verifybackup/pg_verifybackup.c
index 5f055a23a63..801e13886c2 100644
--- a/src/bin/pg_verifybackup/pg_verifybackup.c
+++ b/src/bin/pg_verifybackup/pg_verifybackup.c
@@ -253,7 +253,10 @@ main(int argc, char **argv)
 	 * read, which occurs only when checksum verification is enabled.
 	 */
 	if (!context.skip_checksums)
+	{
 		compute_total_size(&context);
+		progress_report(&context, false);
+	}
 
 	/*
 	 * Now scan the files in the backup directory. At this stage, we verify
@@ -275,7 +278,10 @@ main(int argc, char **argv)
 	 * told to skip it.
 	 */
 	if (!context.skip_checksums)
+	{
 		verify_backup_checksums(&context);
+		progress_report(&context, true);
+	}
 
 	/*
 	 * Try to parse the required ranges of WAL records, unless we were told
@@ -736,8 +742,6 @@ verify_backup_checksums(verifier_context *context)
 	manifest_file *m;
 	uint8	   *buffer;
 
-	progress_report(context, false);
-
 	buffer = pg_malloc(READ_CHUNK_SIZE * sizeof(uint8));
 
 	manifest_files_start_iterate(manifest->files, &it);
@@ -761,8 +765,6 @@ verify_backup_checksums(verifier_context *context)
 	}
 
 	pfree(buffer);
-
-	progress_report(context, true);
 }
 
 /*
-- 
2.18.0