v11-0002-delta.patch
application/octet-stream
Filename: v11-0002-delta.patch
Type: application/octet-stream
Part: 0
Patch
Format: unified
Series: patch v11-0002
| File | + | − |
|---|---|---|
| src/bin/pg_verifybackup/pg_verifybackup.c | 8 | 11 |
diff --git a/src/bin/pg_verifybackup/pg_verifybackup.c b/src/bin/pg_verifybackup/pg_verifybackup.c
index e0e40e3b644..8c034c97c3b 100644
--- a/src/bin/pg_verifybackup/pg_verifybackup.c
+++ b/src/bin/pg_verifybackup/pg_verifybackup.c
@@ -140,7 +140,8 @@ static void verify_backup_directory(verifier_context *context,
char *relpath, char *fullpath);
static void verify_backup_file(verifier_context *context,
char *relpath, char *fullpath);
-static void verify_control_file(verifier_context *context, char *relpath);
+static void verify_control_file(const char *controlpath,
+ uint64 manifest_system_identifier);
static void report_extra_backup_files(verifier_context *context);
static void verify_backup_checksums(verifier_context *context);
static void verify_file_checksum(verifier_context *context,
@@ -690,7 +691,7 @@ verify_backup_file(verifier_context *context, char *relpath, char *fullpath)
*/
if (context->manifest->version != 1 &&
strcmp(relpath, "global/pg_control") == 0)
- verify_control_file(context, relpath);
+ verify_control_file(fullpath, context->manifest->system_identifier);
/* Update statistics for progress report, if necessary */
if (show_progress && !skip_checksums && should_verify_checksum(m))
@@ -705,19 +706,15 @@ verify_backup_file(verifier_context *context, char *relpath, char *fullpath)
}
/*
- * Sanity check control file of the backup and validate system identifier
- * against manifest system identifier.
+ * Sanity check control file and validate system identifier against manifest
+ * system identifier.
*/
static void
-verify_control_file(verifier_context *context, char *relpath)
+verify_control_file(const char *controlpath, uint64 manifest_system_identifier)
{
- manifest_data *manifest = context->manifest;
- char *backup_directory = context->backup_directory;
- char *controlpath;
ControlFileData *control_file;
bool crc_ok;
- controlpath = psprintf("%s/%s", backup_directory, relpath);
pg_log_debug("reading \"%s\"", controlpath);
control_file = get_controlfile_by_exact_path(controlpath, &crc_ok);
@@ -731,10 +728,10 @@ verify_control_file(verifier_context *context, char *relpath)
controlpath);
/* System identifiers should match. */
- if (manifest->system_identifier != control_file->system_identifier)
+ if (manifest_system_identifier != control_file->system_identifier)
report_fatal_error("%s: manifest system identifier is %llu, but control file has %llu",
controlpath,
- (unsigned long long) manifest->system_identifier,
+ (unsigned long long) manifest_system_identifier,
(unsigned long long) control_file->system_identifier);
/* Release memory. */