summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Eisentraut <peter@eisentraut.org>2025-08-26 22:48:00 +0200
committerPeter Eisentraut <peter@eisentraut.org>2025-08-26 22:52:11 +0200
commite567e22290544c57293f8e5a913292dacd3bcd1a (patch)
tree66e290cec3f67130f52d0f7d5d18741135895cd1
parent984d7165dde7133dbdddc95e95ff56bbb177f628 (diff)
Message style improvements
Mostly adding some quoting.
-rw-r--r--src/backend/catalog/storage.c2
-rw-r--r--src/backend/storage/aio/method_io_uring.c2
-rw-r--r--src/backend/storage/buffer/bufmgr.c34
-rw-r--r--src/test/modules/test_aio/t/001_aio.pl44
4 files changed, 42 insertions, 40 deletions
diff --git a/src/backend/catalog/storage.c b/src/backend/catalog/storage.c
index fb784acf4af..c58e9418ac3 100644
--- a/src/backend/catalog/storage.c
+++ b/src/backend/catalog/storage.c
@@ -546,7 +546,7 @@ RelationCopyStorage(SMgrRelation src, SMgrRelation dst,
ereport(ERROR,
(errcode(ERRCODE_DATA_CORRUPTED),
- errmsg("invalid page in block %u of relation %s",
+ errmsg("invalid page in block %u of relation \"%s\"",
blkno, relpath.str)));
}
diff --git a/src/backend/storage/aio/method_io_uring.c b/src/backend/storage/aio/method_io_uring.c
index 0a8c054162f..093a71359ef 100644
--- a/src/backend/storage/aio/method_io_uring.c
+++ b/src/backend/storage/aio/method_io_uring.c
@@ -377,7 +377,7 @@ pgaio_uring_shmem_init(bool first_time)
else if (-ret == ENOSYS)
{
err = ERRCODE_FEATURE_NOT_SUPPORTED;
- hint = _("Kernel does not support io_uring.");
+ hint = _("The kernel does not support io_uring.");
}
/* update errno to allow %m to work */
diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c
index fd7e21d96d3..350cc0402aa 100644
--- a/src/backend/storage/buffer/bufmgr.c
+++ b/src/backend/storage/buffer/bufmgr.c
@@ -2769,7 +2769,7 @@ ExtendBufferedRelShared(BufferManagerRelation bmr,
if (valid && !PageIsNew((Page) buf_block))
ereport(ERROR,
- (errmsg("unexpected data beyond EOF in block %u of relation %s",
+ (errmsg("unexpected data beyond EOF in block %u of relation \"%s\"",
existing_hdr->tag.blockNum,
relpath(bmr.smgr->smgr_rlocator, fork).str)));
@@ -6191,7 +6191,7 @@ shared_buffer_write_error_callback(void *arg)
/* Buffer is pinned, so we can read the tag without locking the spinlock */
if (bufHdr != NULL)
- errcontext("writing block %u of relation %s",
+ errcontext("writing block %u of relation \"%s\"",
bufHdr->tag.blockNum,
relpathperm(BufTagGetRelFileLocator(&bufHdr->tag),
BufTagGetForkNum(&bufHdr->tag)).str);
@@ -6206,7 +6206,7 @@ local_buffer_write_error_callback(void *arg)
BufferDesc *bufHdr = (BufferDesc *) arg;
if (bufHdr != NULL)
- errcontext("writing block %u of relation %s",
+ errcontext("writing block %u of relation \"%s\"",
bufHdr->tag.blockNum,
relpathbackend(BufTagGetRelFileLocator(&bufHdr->tag),
MyProcNumber,
@@ -7305,13 +7305,15 @@ buffer_readv_report(PgAioResult result, const PgAioTargetData *td,
ereport(elevel,
errcode(ERRCODE_DATA_CORRUPTED),
- errmsg("zeroing %u page(s) and ignoring %u checksum failure(s) among blocks %u..%u of relation %s",
+ errmsg("zeroing %u page(s) and ignoring %u checksum failure(s) among blocks %u..%u of relation \"%s\"",
affected_count, checkfail_count, first, last, rpath.str),
affected_count > 1 ?
- errdetail("Block %u held first zeroed page.",
+ errdetail("Block %u held the first zeroed page.",
first + first_off) : 0,
- errhint("See server log for details about the other %d invalid block(s).",
- affected_count + checkfail_count - 1));
+ errhint_plural("See server log for details about the other %d invalid block.",
+ "See server log for details about the other %d invalid blocks.",
+ affected_count + checkfail_count - 1,
+ affected_count + checkfail_count - 1));
return;
}
@@ -7324,25 +7326,25 @@ buffer_readv_report(PgAioResult result, const PgAioTargetData *td,
{
Assert(!zeroed_any); /* can't have invalid pages when zeroing them */
affected_count = zeroed_or_error_count;
- msg_one = _("invalid page in block %u of relation %s");
- msg_mult = _("%u invalid pages among blocks %u..%u of relation %s");
- det_mult = _("Block %u held first invalid page.");
+ msg_one = _("invalid page in block %u of relation \"%s\"");
+ msg_mult = _("%u invalid pages among blocks %u..%u of relation \"%s\"");
+ det_mult = _("Block %u held the first invalid page.");
hint_mult = _("See server log for the other %u invalid block(s).");
}
else if (zeroed_any && !ignored_any)
{
affected_count = zeroed_or_error_count;
- msg_one = _("invalid page in block %u of relation %s; zeroing out page");
- msg_mult = _("zeroing out %u invalid pages among blocks %u..%u of relation %s");
- det_mult = _("Block %u held first zeroed page.");
+ msg_one = _("invalid page in block %u of relation \"%s\"; zeroing out page");
+ msg_mult = _("zeroing out %u invalid pages among blocks %u..%u of relation \"%s\"");
+ det_mult = _("Block %u held the first zeroed page.");
hint_mult = _("See server log for the other %u zeroed block(s).");
}
else if (!zeroed_any && ignored_any)
{
affected_count = checkfail_count;
- msg_one = _("ignoring checksum failure in block %u of relation %s");
- msg_mult = _("ignoring %u checksum failures among blocks %u..%u of relation %s");
- det_mult = _("Block %u held first ignored page.");
+ msg_one = _("ignoring checksum failure in block %u of relation \"%s\"");
+ msg_mult = _("ignoring %u checksum failures among blocks %u..%u of relation \"%s\"");
+ det_mult = _("Block %u held the first ignored page.");
hint_mult = _("See server log for the other %u ignored block(s).");
}
else
diff --git a/src/test/modules/test_aio/t/001_aio.pl b/src/test/modules/test_aio/t/001_aio.pl
index 82ffffc058f..3f0453619e8 100644
--- a/src/test/modules/test_aio/t/001_aio.pl
+++ b/src/test/modules/test_aio/t/001_aio.pl
@@ -396,8 +396,8 @@ SELECT modify_rel_block('tmp_corr', 1, corrupt_header=>true);
{
my $invalid_page_re =
$tblname eq 'tbl_corr'
- ? qr/invalid page in block 1 of relation base\/\d+\/\d+/
- : qr/invalid page in block 1 of relation base\/\d+\/t\d+_\d+/;
+ ? qr/invalid page in block 1 of relation "base\/\d+\/\d+/
+ : qr/invalid page in block 1 of relation "base\/\d+\/t\d+_\d+/;
# verify the error is reported in custom C code
psql_like(
@@ -798,7 +798,7 @@ SELECT inj_io_short_read_attach(8192);
"shortened multi-block read detects invalid page",
qq(SELECT count(*) FROM tbl_corr WHERE ctid < '(2, 1)'),
qr/^$/,
- qr/ERROR:.*invalid page in block 1 of relation base\/.*/);
+ qr/ERROR:.*invalid page in block 1 of relation "base\/.*/);
# trigger a hard error, should error out
$psql->query_safe(
@@ -985,7 +985,7 @@ SELECT modify_rel_block('tbl_zero', 0, corrupt_header=>true);
qq(
SELECT read_rel_block_ll('tbl_zero', 0, zero_on_error=>false)),
qr/^$/,
- qr/^psql:<stdin>:\d+: ERROR: invalid page in block 0 of relation base\/.*\/.*$/
+ qr/^psql:<stdin>:\d+: ERROR: invalid page in block 0 of relation "base\/.*\/.*$/
);
# Check that page validity errors are zeroed
@@ -996,7 +996,7 @@ SELECT read_rel_block_ll('tbl_zero', 0, zero_on_error=>false)),
qq(
SELECT read_rel_block_ll('tbl_zero', 0, zero_on_error=>true)),
qr/^$/,
- qr/^psql:<stdin>:\d+: WARNING: invalid page in block 0 of relation base\/.*\/.*; zeroing out page$/
+ qr/^psql:<stdin>:\d+: WARNING: invalid page in block 0 of relation "base\/.*\/.*"; zeroing out page$/
);
# And that once the corruption is fixed, we can read again
@@ -1027,7 +1027,7 @@ SELECT modify_rel_block('tbl_zero', 3, corrupt_header=>true);
"$persistency: test zeroing of invalid block 3",
qq(SELECT read_rel_block_ll('tbl_zero', 3, zero_on_error=>true);),
qr/^$/,
- qr/^psql:<stdin>:\d+: WARNING: invalid page in block 3 of relation base\/.*\/.*; zeroing out page$/
+ qr/^psql:<stdin>:\d+: WARNING: invalid page in block 3 of relation "base\/.*\/.*"; zeroing out page$/
);
@@ -1044,7 +1044,7 @@ SELECT modify_rel_block('tbl_zero', 3, corrupt_header=>true);
"$persistency: test reading of invalid block 2,3 in larger read",
qq(SELECT read_rel_block_ll('tbl_zero', 1, nblocks=>4, zero_on_error=>false)),
qr/^$/,
- qr/^psql:<stdin>:\d+: ERROR: 2 invalid pages among blocks 1..4 of relation base\/.*\/.*\nDETAIL: Block 2 held first invalid page\.\nHINT:[^\n]+$/
+ qr/^psql:<stdin>:\d+: ERROR: 2 invalid pages among blocks 1..4 of relation "base\/.*\/.*\nDETAIL: Block 2 held the first invalid page\.\nHINT:[^\n]+$/
);
# Then test zeroing via ZERO_ON_ERROR flag
@@ -1054,7 +1054,7 @@ SELECT modify_rel_block('tbl_zero', 3, corrupt_header=>true);
"$persistency: test zeroing of invalid block 2,3 in larger read, ZERO_ON_ERROR",
qq(SELECT read_rel_block_ll('tbl_zero', 1, nblocks=>4, zero_on_error=>true)),
qr/^$/,
- qr/^psql:<stdin>:\d+: WARNING: zeroing out 2 invalid pages among blocks 1..4 of relation base\/.*\/.*\nDETAIL: Block 2 held first zeroed page\.\nHINT:[^\n]+$/
+ qr/^psql:<stdin>:\d+: WARNING: zeroing out 2 invalid pages among blocks 1..4 of relation "base\/.*\/.*\nDETAIL: Block 2 held the first zeroed page\.\nHINT:[^\n]+$/
);
# Then test zeroing via zero_damaged_pages
@@ -1069,7 +1069,7 @@ SELECT read_rel_block_ll('tbl_zero', 1, nblocks=>4, zero_on_error=>false)
COMMIT;
),
qr/^$/,
- qr/^psql:<stdin>:\d+: WARNING: zeroing out 2 invalid pages among blocks 1..4 of relation base\/.*\/.*\nDETAIL: Block 2 held first zeroed page\.\nHINT:[^\n]+$/
+ qr/^psql:<stdin>:\d+: WARNING: zeroing out 2 invalid pages among blocks 1..4 of relation "base\/.*\/.*\nDETAIL: Block 2 held the first zeroed page\.\nHINT:[^\n]+$/
);
$psql_a->query_safe(qq(COMMIT));
@@ -1091,7 +1091,7 @@ SELECT modify_rel_block('tbl_zero', 3, zero=>true);
qq(
SELECT count(*) FROM tbl_zero),
qr/^$/,
- qr/^psql:<stdin>:\d+: ERROR: invalid page in block 2 of relation base\/.*\/.*$/
+ qr/^psql:<stdin>:\d+: ERROR: invalid page in block 2 of relation "base\/.*\/.*$/
);
# Verify that bufmgr.c IO zeroes out pages with page validity errors
@@ -1106,7 +1106,7 @@ SELECT count(*) FROM tbl_zero;
COMMIT;
),
qr/^\d+$/,
- qr/^psql:<stdin>:\d+: WARNING: invalid page in block 2 of relation base\/.*\/.*$/
+ qr/^psql:<stdin>:\d+: WARNING: invalid page in block 2 of relation "base\/.*\/.*$/
);
# Check that warnings/errors about page validity in an IO started by
@@ -1192,7 +1192,7 @@ SELECT modify_rel_block('pg_shseclabel', 3, corrupt_checksum=>true);
qq(
SELECT read_rel_block_ll('tbl_normal', 3, nblocks=>1, zero_on_error=>false);),
qr/^$/,
- qr/^psql:<stdin>:\d+: ERROR: invalid page in block 3 of relation base\/\d+\/\d+$/
+ qr/^psql:<stdin>:\d+: ERROR: invalid page in block 3 of relation "base\/\d+\/\d+"$/
);
my ($cs_count_after, $cs_ts_after) =
@@ -1214,7 +1214,7 @@ SELECT read_rel_block_ll('tbl_normal', 3, nblocks=>1, zero_on_error=>false);),
qq(
SELECT read_rel_block_ll('tbl_temp', 4, nblocks=>2, zero_on_error=>false);),
qr/^$/,
- qr/^psql:<stdin>:\d+: ERROR: invalid page in block 4 of relation base\/\d+\/t\d+_\d+$/
+ qr/^psql:<stdin>:\d+: ERROR: invalid page in block 4 of relation "base\/\d+\/t\d+_\d+"$/
);
($cs_count_after, $cs_ts_after) = checksum_failures($psql_a, 'postgres');
@@ -1235,7 +1235,7 @@ SELECT read_rel_block_ll('tbl_temp', 4, nblocks=>2, zero_on_error=>false);),
qq(
SELECT read_rel_block_ll('pg_shseclabel', 2, nblocks=>2, zero_on_error=>false);),
qr/^$/,
- qr/^psql:<stdin>:\d+: ERROR: 2 invalid pages among blocks 2..3 of relation global\/\d+\nDETAIL: Block 2 held first invalid page\.\nHINT:[^\n]+$/
+ qr/^psql:<stdin>:\d+: ERROR: 2 invalid pages among blocks 2..3 of relation "global\/\d+"\nDETAIL: Block 2 held the first invalid page\.\nHINT:[^\n]+$/
);
($cs_count_after, $cs_ts_after) = checksum_failures($psql_a);
@@ -1300,7 +1300,7 @@ STRATEGY wal_log;
"create database w/ wal strategy, invalid source",
$createdb_sql,
qr/^$/,
- qr/psql:<stdin>:\d+: ERROR: invalid page in block 1 of relation base\/\d+\/\d+$/
+ qr/psql:<stdin>:\d+: ERROR: invalid page in block 1 of relation "base\/\d+\/\d+"$/
);
my ($cs_count_after, $cs_ts_after) =
checksum_failures($psql, 'regression_createdb_source');
@@ -1409,7 +1409,7 @@ SELECT read_rel_block_ll('tbl_cs_fail', 3, nblocks=>1, zero_on_error=>false);),
qq(
SELECT read_rel_block_ll('tbl_cs_fail', 2, nblocks=>3, zero_on_error=>false);),
qr/^$/,
- qr/^psql:<stdin>:\d+: ERROR: invalid page in block 4 of relation base\/\d+\/\d+$/
+ qr/^psql:<stdin>:\d+: ERROR: invalid page in block 4 of relation "base\/\d+\/\d+"$/
);
# Test multi-block read with different problems in different blocks
@@ -1431,7 +1431,7 @@ SELECT modify_rel_block('tbl_cs_fail', 5, corrupt_header=>true);
qq(
SELECT read_rel_block_ll('tbl_cs_fail', 1, nblocks=>5, zero_on_error=>true);),
qr/^$/,
- qr/^psql:<stdin>:\d+: WARNING: zeroing 3 page\(s\) and ignoring 2 checksum failure\(s\) among blocks 1..5 of relation/
+ qr/^psql:<stdin>:\d+: WARNING: zeroing 3 page\(s\) and ignoring 2 checksum failure\(s\) among blocks 1..5 of relation "/
);
@@ -1444,17 +1444,17 @@ SELECT read_rel_block_ll('tbl_cs_fail', 1, nblocks=>5, zero_on_error=>true);),
ok(1, "$io_method: found information about checksum failure in block 2");
$node->wait_for_log(
- qr/LOG: invalid page in block 3 of relation base.*; zeroing out page/,
+ qr/LOG: invalid page in block 3 of relation "base.*"; zeroing out page/,
$log_location);
ok(1, "$io_method: found information about invalid page in block 3");
$node->wait_for_log(
- qr/LOG: invalid page in block 4 of relation base.*; zeroing out page/,
+ qr/LOG: invalid page in block 4 of relation "base.*"; zeroing out page/,
$log_location);
ok(1, "$io_method: found information about checksum failure in block 4");
$node->wait_for_log(
- qr/LOG: invalid page in block 5 of relation base.*; zeroing out page/,
+ qr/LOG: invalid page in block 5 of relation "base.*"; zeroing out page/,
$log_location);
ok(1, "$io_method: found information about checksum failure in block 5");
@@ -1473,7 +1473,7 @@ SELECT modify_rel_block('tbl_cs_fail', 3, corrupt_checksum=>true, corrupt_header
qq(
SELECT read_rel_block_ll('tbl_cs_fail', 3, nblocks=>1, zero_on_error=>false);),
qr/^$/,
- qr/^psql:<stdin>:\d+: ERROR: invalid page in block 3 of relation/);
+ qr/^psql:<stdin>:\d+: ERROR: invalid page in block 3 of relation "/);
psql_like(
$io_method,
@@ -1482,7 +1482,7 @@ SELECT read_rel_block_ll('tbl_cs_fail', 3, nblocks=>1, zero_on_error=>false);),
qq(
SELECT read_rel_block_ll('tbl_cs_fail', 3, nblocks=>1, zero_on_error=>true);),
qr/^$/,
- qr/^psql:<stdin>:\d+: WARNING: invalid page in block 3 of relation base\/.*; zeroing out page/
+ qr/^psql:<stdin>:\d+: WARNING: invalid page in block 3 of relation "base\/.*"; zeroing out page/
);