pg_verifybackup: Message style improvements
authorPeter Eisentraut <[email protected]>
Tue, 29 Apr 2025 07:19:15 +0000 (09:19 +0200)
committerPeter Eisentraut <[email protected]>
Tue, 29 Apr 2025 07:19:15 +0000 (09:19 +0200)
src/bin/pg_verifybackup/astreamer_verify.c
src/bin/pg_verifybackup/pg_verifybackup.c
src/bin/pg_verifybackup/t/003_corruption.pl
src/bin/pg_verifybackup/t/004_options.pl

index 268c5f0e24635716f6b26e7286e7cfcb6c8eb2a6..33cf67670a70d7557473cb605aa1daa01749da51 100644 (file)
@@ -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);
 }
 
index a034d5211233164ff1e379af6b432989d2ce13a0..48994ef9bc6fce558d38c460a6095cc724424613 100644 (file)
@@ -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;
    }
index 84f23b8bc3d1a5088edcabdd6b123f474e88afa7..1dd60f709cf66f0c26a464819a083f9af3d029ef 100644 (file)
@@ -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',
index 8c83dc7189ec3702bb8c56e921091a696b5d10c8..3cdbe816862e1b1e5ce438b014c27228b71e94e7 100644 (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