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:
|
||||
/* 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)
|
||||
{
|
||||
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);
|
||||
return;
|
||||
}
|
||||
@ -208,7 +208,7 @@ member_verify_header(astreamer *streamer, astreamer_member *member)
|
||||
if (m->size != member->size)
|
||||
{
|
||||
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,
|
||||
(unsigned long long) member->size,
|
||||
mystreamer->archive_name,
|
||||
@ -297,7 +297,7 @@ member_verify_checksum(astreamer *streamer)
|
||||
if (mystreamer->checksum_bytes != m->size)
|
||||
{
|
||||
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->size,
|
||||
mystreamer->checksum_bytes);
|
||||
@ -317,12 +317,12 @@ member_verify_checksum(astreamer *streamer)
|
||||
/* And check it against the manifest. */
|
||||
if (checksumlen != m->checksum_length)
|
||||
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->checksum_length, checksumlen);
|
||||
else if (memcmp(checksumbuf, m->checksum_payload, checksumlen) != 0)
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -338,7 +338,7 @@ main(int argc, char **argv)
|
||||
if (!no_parse_wal && context.format == 't')
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
@ -694,11 +694,11 @@ verify_plain_backup_file(verifier_context *context, char *relpath,
|
||||
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))
|
||||
{
|
||||
report_backup_error(context,
|
||||
"\"%s\" is not a file or directory",
|
||||
"\"%s\" is not a regular file or directory",
|
||||
relpath);
|
||||
return;
|
||||
}
|
||||
@ -899,11 +899,11 @@ precheck_tar_backup_file(verifier_context *context, char *relpath,
|
||||
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))
|
||||
{
|
||||
report_backup_error(context,
|
||||
"\"%s\" is not a plain file",
|
||||
"file \"%s\" is not a regular file",
|
||||
relpath);
|
||||
return;
|
||||
}
|
||||
|
@ -37,37 +37,37 @@ my @scenario = (
|
||||
'name' => 'extra_file',
|
||||
'mutilate' => \&mutilate_extra_file,
|
||||
'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',
|
||||
'mutilate' => \&mutilate_extra_tablespace_file,
|
||||
'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',
|
||||
'mutilate' => \&mutilate_missing_file,
|
||||
'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',
|
||||
'mutilate' => \&mutilate_missing_tablespace,
|
||||
'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',
|
||||
'mutilate' => \&mutilate_append_to_file,
|
||||
'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',
|
||||
'mutilate' => \&mutilate_truncate_file,
|
||||
'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',
|
||||
|
@ -53,7 +53,7 @@ $primary->command_fails_like(
|
||||
'--no-parse-wal',
|
||||
$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");
|
||||
|
||||
# Test invalid options
|
||||
|
Loading…
x
Reference in New Issue
Block a user