From d89200d65e3a9cc2e8737ebea850e63c41a6e0e6 Mon Sep 17 00:00:00 2001 From: Amul Sul Date: Wed, 16 Jul 2025 14:47:43 +0530 Subject: [PATCH v6 6/8] pg_verifybackup: Delay default WAL directory preparation. We are not sure whether to parse WAL from a directory or an archive until the backup format is known. Therefore, we delay preparing the default WAL directory until the point of parsing. This delay is harmless, as the WAL directory is not used elsewhere. --- src/bin/pg_verifybackup/pg_verifybackup.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/bin/pg_verifybackup/pg_verifybackup.c b/src/bin/pg_verifybackup/pg_verifybackup.c index 8d5befa947f..a502e795b2e 100644 --- a/src/bin/pg_verifybackup/pg_verifybackup.c +++ b/src/bin/pg_verifybackup/pg_verifybackup.c @@ -285,10 +285,6 @@ main(int argc, char **argv) manifest_path = psprintf("%s/backup_manifest", context.backup_directory); - /* By default, look for the WAL in the backup directory, too. */ - if (wal_directory == NULL) - wal_directory = psprintf("%s/pg_wal", context.backup_directory); - /* * Try to read the manifest. We treat any errors encountered while parsing * the manifest as fatal; there doesn't seem to be much point in trying to @@ -368,6 +364,10 @@ main(int argc, char **argv) if (context.format == 'p' && !context.skip_checksums) verify_backup_checksums(&context); + /* By default, look for the WAL in the backup directory, too. */ + if (wal_directory == NULL) + wal_directory = psprintf("%s/pg_wal", context.backup_directory); + /* * Try to parse the required ranges of WAL records, unless we were told * not to do so. -- 2.47.1