| From: | Álvaro Herrera <alvherre(at)kurilemu(dot)de> |
|---|---|
| To: | Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)com> |
| Cc: | Andres Freund <andres(at)anarazel(dot)de>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>, Postgres hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
| Subject: | Re: Odd usage of errmsg_internal in bufmgr.c |
| Date: | 2026-02-12 19:16:52 |
| Message-ID: | 202602121900.v33apcph362r@alvherre.pgsql |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
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/
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Andres Freund | 2026-02-12 19:17:34 | Re: Odd usage of errmsg_internal in bufmgr.c |
| Previous Message | Andres Freund | 2026-02-12 19:12:14 | Re: Odd usage of errmsg_internal in bufmgr.c |