mirror of
https://github.com/postgres/postgres.git
synced 2025-05-29 16:21:20 +03:00
pg_verifybackup: Message style improvements
This commit is contained in:
parent
c893245ec3
commit
ef1811ac9a
@ -127,7 +127,7 @@ astreamer_verify_content(astreamer *streamer, astreamer_member *member,
|
|||||||
|
|
||||||
default:
|
default:
|
||||||
/* Shouldn't happen. */
|
/* Shouldn't happen. */
|
||||||
pg_fatal("unexpected state while parsing tar file");
|
pg_fatal("unexpected state while parsing tar archive");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -195,7 +195,7 @@ member_verify_header(astreamer *streamer, astreamer_member *member)
|
|||||||
if (m == NULL)
|
if (m == NULL)
|
||||||
{
|
{
|
||||||
report_backup_error(mystreamer->context,
|
report_backup_error(mystreamer->context,
|
||||||
"\"%s\" is present in \"%s\" but not in the manifest",
|
"file \"%s\" is present in archive \"%s\" but not in the manifest",
|
||||||
member->pathname, mystreamer->archive_name);
|
member->pathname, mystreamer->archive_name);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -208,7 +208,7 @@ member_verify_header(astreamer *streamer, astreamer_member *member)
|
|||||||
if (m->size != member->size)
|
if (m->size != member->size)
|
||||||
{
|
{
|
||||||
report_backup_error(mystreamer->context,
|
report_backup_error(mystreamer->context,
|
||||||
"\"%s\" has size %llu in \"%s\" but size %" PRIu64 " in the manifest",
|
"file \"%s\" has size %llu in archive \"%s\" but size %" PRIu64 " in the manifest",
|
||||||
member->pathname,
|
member->pathname,
|
||||||
(unsigned long long) member->size,
|
(unsigned long long) member->size,
|
||||||
mystreamer->archive_name,
|
mystreamer->archive_name,
|
||||||
@ -297,7 +297,7 @@ member_verify_checksum(astreamer *streamer)
|
|||||||
if (mystreamer->checksum_bytes != m->size)
|
if (mystreamer->checksum_bytes != m->size)
|
||||||
{
|
{
|
||||||
report_backup_error(mystreamer->context,
|
report_backup_error(mystreamer->context,
|
||||||
"file \"%s\" in \"%s\" should contain %" PRIu64 " bytes, but read %" PRIu64 " bytes",
|
"file \"%s\" in archive \"%s\" should contain %" PRIu64 " bytes, but %" PRIu64 " bytes were read",
|
||||||
m->pathname, mystreamer->archive_name,
|
m->pathname, mystreamer->archive_name,
|
||||||
m->size,
|
m->size,
|
||||||
mystreamer->checksum_bytes);
|
mystreamer->checksum_bytes);
|
||||||
@ -317,12 +317,12 @@ member_verify_checksum(astreamer *streamer)
|
|||||||
/* And check it against the manifest. */
|
/* And check it against the manifest. */
|
||||||
if (checksumlen != m->checksum_length)
|
if (checksumlen != m->checksum_length)
|
||||||
report_backup_error(mystreamer->context,
|
report_backup_error(mystreamer->context,
|
||||||
"file \"%s\" in \"%s\" has checksum of length %d, but expected %d",
|
"file \"%s\" in archive \"%s\" has checksum of length %d, but expected %d",
|
||||||
m->pathname, mystreamer->archive_name,
|
m->pathname, mystreamer->archive_name,
|
||||||
m->checksum_length, checksumlen);
|
m->checksum_length, checksumlen);
|
||||||
else if (memcmp(checksumbuf, m->checksum_payload, checksumlen) != 0)
|
else if (memcmp(checksumbuf, m->checksum_payload, checksumlen) != 0)
|
||||||
report_backup_error(mystreamer->context,
|
report_backup_error(mystreamer->context,
|
||||||
"checksum mismatch for file \"%s\" in \"%s\"",
|
"checksum mismatch for file \"%s\" in archive \"%s\"",
|
||||||
m->pathname, mystreamer->archive_name);
|
m->pathname, mystreamer->archive_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -338,7 +338,7 @@ main(int argc, char **argv)
|
|||||||
if (!no_parse_wal && context.format == 't')
|
if (!no_parse_wal && context.format == 't')
|
||||||
{
|
{
|
||||||
pg_log_error("pg_waldump cannot read tar files");
|
pg_log_error("pg_waldump cannot read tar files");
|
||||||
pg_log_error_hint("You must use -n or --no-parse-wal when verifying a tar-format backup.");
|
pg_log_error_hint("You must use -n/--no-parse-wal when verifying a tar-format backup.");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -694,11 +694,11 @@ verify_plain_backup_file(verifier_context *context, char *relpath,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If it's not a directory, it should be a plain file. */
|
/* If it's not a directory, it should be a regular file. */
|
||||||
if (!S_ISREG(sb.st_mode))
|
if (!S_ISREG(sb.st_mode))
|
||||||
{
|
{
|
||||||
report_backup_error(context,
|
report_backup_error(context,
|
||||||
"\"%s\" is not a file or directory",
|
"\"%s\" is not a regular file or directory",
|
||||||
relpath);
|
relpath);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -899,11 +899,11 @@ precheck_tar_backup_file(verifier_context *context, char *relpath,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* In a tar format backup, we expect only plain files. */
|
/* In a tar format backup, we expect only regular files. */
|
||||||
if (!S_ISREG(sb.st_mode))
|
if (!S_ISREG(sb.st_mode))
|
||||||
{
|
{
|
||||||
report_backup_error(context,
|
report_backup_error(context,
|
||||||
"\"%s\" is not a plain file",
|
"file \"%s\" is not a regular file",
|
||||||
relpath);
|
relpath);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -37,37 +37,37 @@ my @scenario = (
|
|||||||
'name' => 'extra_file',
|
'name' => 'extra_file',
|
||||||
'mutilate' => \&mutilate_extra_file,
|
'mutilate' => \&mutilate_extra_file,
|
||||||
'fails_like' =>
|
'fails_like' =>
|
||||||
qr/extra_file.*present (on disk|in "[^"]+") but not in the manifest/
|
qr/extra_file.*present (on disk|in archive "[^"]+") but not in the manifest/
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'name' => 'extra_tablespace_file',
|
'name' => 'extra_tablespace_file',
|
||||||
'mutilate' => \&mutilate_extra_tablespace_file,
|
'mutilate' => \&mutilate_extra_tablespace_file,
|
||||||
'fails_like' =>
|
'fails_like' =>
|
||||||
qr/extra_ts_file.*present (on disk|in "[^"]+") but not in the manifest/
|
qr/extra_ts_file.*present (on disk|in archive "[^"]+") but not in the manifest/
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'name' => 'missing_file',
|
'name' => 'missing_file',
|
||||||
'mutilate' => \&mutilate_missing_file,
|
'mutilate' => \&mutilate_missing_file,
|
||||||
'fails_like' =>
|
'fails_like' =>
|
||||||
qr/pg_xact\/0000.*present in the manifest but not (on disk|in "[^"]+")/
|
qr/pg_xact\/0000.*present in the manifest but not (on disk|in archive "[^"]+")/
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'name' => 'missing_tablespace',
|
'name' => 'missing_tablespace',
|
||||||
'mutilate' => \&mutilate_missing_tablespace,
|
'mutilate' => \&mutilate_missing_tablespace,
|
||||||
'fails_like' =>
|
'fails_like' =>
|
||||||
qr/pg_tblspc.*present in the manifest but not (on disk|in "[^"]+")/
|
qr/pg_tblspc.*present in the manifest but not (on disk|in archive "[^"]+")/
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'name' => 'append_to_file',
|
'name' => 'append_to_file',
|
||||||
'mutilate' => \&mutilate_append_to_file,
|
'mutilate' => \&mutilate_append_to_file,
|
||||||
'fails_like' =>
|
'fails_like' =>
|
||||||
qr/has size \d+ (on disk|in "[^"]+") but size \d+ in the manifest/
|
qr/has size \d+ (on disk|in archive "[^"]+") but size \d+ in the manifest/
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'name' => 'truncate_file',
|
'name' => 'truncate_file',
|
||||||
'mutilate' => \&mutilate_truncate_file,
|
'mutilate' => \&mutilate_truncate_file,
|
||||||
'fails_like' =>
|
'fails_like' =>
|
||||||
qr/has size 0 (on disk|in "[^"]+") but size \d+ in the manifest/
|
qr/has size 0 (on disk|in archive "[^"]+") but size \d+ in the manifest/
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'name' => 'replace_file',
|
'name' => 'replace_file',
|
||||||
|
@ -53,7 +53,7 @@ $primary->command_fails_like(
|
|||||||
'--no-parse-wal',
|
'--no-parse-wal',
|
||||||
$backup_path
|
$backup_path
|
||||||
],
|
],
|
||||||
qr("pg_multixact" is not a plain file),
|
qr("pg_multixact" is not a regular file),
|
||||||
"does not verify with --format=tar --no-parse-wal");
|
"does not verify with --format=tar --no-parse-wal");
|
||||||
|
|
||||||
# Test invalid options
|
# Test invalid options
|
||||||
|
Loading…
x
Reference in New Issue
Block a user