On 2026-Feb-12, Zsolt Parragi wrote:
> > Perhaps gratuitously so ... For instance, AFAICS the first block could
> > be:
>
>
> I also tried to play with a few variants for this, and I reached the
> same conclusion: the cleanest version is when we simply repeat the
> messages.
But you know what's strange? There are actually *no* messages that
appear more than once. The ereport calls all use different messages.
The only thing that appears multiple times is
errcode(ERRCODE_DATA_CORRUPTED). This is because there's either one
errmsg with no detail/hint (in the single page case), or the other
errmsg() with detail and hint (when multiple pages are affected).
I don't understand why the hint says "see server log for the other
blocks", though ... what part of the code emits that information?
[ ... some cscope jumping later ... ] Is it md_readv_report?
if (result.status == PGAIO_RS_ERROR)
{
Assert(!zeroed_any); /* can't have invalid pages when zeroing them */
if (zeroed_or_error_count == 1)
ereport(elevel,
errcode(ERRCODE_DATA_CORRUPTED),
errmsg("invalid page in block %u of relation \"%s\"",
first + first_off, rpath.str));
else
ereport(elevel,
errcode(ERRCODE_DATA_CORRUPTED),
errmsg("%u invalid pages among blocks %u..%u of relation
\"%s\"",
zeroed_or_error_count, first, last, rpath.str),
errdetail("Block %u held the first invalid page.",
first + first_off),
errhint("See server log for the other %u invalid block(s).",
zeroed_or_error_count - 1));
}
else if (zeroed_any && !ignored_any)
{
if (zeroed_or_error_count == 1)
ereport(elevel,
errcode(ERRCODE_DATA_CORRUPTED),
errmsg("invalid page in block %u of relation \"%s\";
zeroing out page",
first + first_off, rpath.str));
else
ereport(elevel,
errcode(ERRCODE_DATA_CORRUPTED),
errmsg("zeroing out %u invalid pages among blocks %u..%u of
relation \"%s\"",
zeroed_or_error_count, first, last, rpath.str),
errdetail("Block %u held the first zeroed page.",
first + first_off),
errhint("See server log for the other %u zeroed block(s).",
zeroed_or_error_count - 1));
}
else if (!zeroed_any && ignored_any)
{
if (checkfail_count == 1)
ereport(elevel,
errcode(ERRCODE_DATA_CORRUPTED),
errmsg("ignoring checksum failure in block %u of relation
\"%s\"",
first + first_off, rpath.str));
else
ereport(elevel,
errcode(ERRCODE_DATA_CORRUPTED),
errmsg("ignoring %u checksum failures among blocks %u..%u
of relation \"%s\"",
checkfail_count, first, last, rpath.str),
errdetail("Block %u held the first ignored page.",
first + first_off),
errhint("See server log for the other %u ignored block(s).",
checkfail_count - 1));
}
else
pg_unreachable();
--
Álvaro Herrera Breisgau, Deutschland — https://www.EnterpriseDB.com/