| From: | Álvaro Herrera <alvherre(at)kurilemu(dot)de> |
|---|---|
| To: | Andres Freund <andres(at)anarazel(dot)de> |
| Cc: | 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 17:53:34 |
| Message-ID: | 202602121738.uhxgae22km6z@alvherre.pgsql |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On 2026-Feb-12, Andres Freund wrote:
> I think the code after the proposed change is considerably harder to read.
Perhaps gratuitously so ... For instance, AFAICS the first block could
be:
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));
}
which does the same, is easier to read, contains no duplicate messages,
and still allows the whole sequence fit in one screenful.
I'm confused about the meaning of "Block [first+first_off] held the
first invalid page.", though ... what exactly does that mean? What does
(first+first_off) represent? Block of what? How is (first) different
from (first+first_off)? The comments on buffer_readv_decode_error() and
buffer_readv_encode_error() leave me none the wiser. Is the segment
size relevant to how I must interpret that number?
--
Álvaro Herrera Breisgau, Deutschland — https://www.EnterpriseDB.com/
"Los trabajadores menos efectivos son sistematicamente llevados al lugar
donde pueden hacer el menor daño posible: gerencia." (El principio Dilbert)
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Alexandre Felipe | 2026-02-12 18:08:26 | Re: Incremental View Maintenance, take 2 |
| Previous Message | Heikki Linnakangas | 2026-02-12 17:42:20 | Re: pgsql: Introduce pg_shmem_allocations_numa view |