Re: Odd usage of errmsg_internal in bufmgr.c - Mailing list pgsql-hackers

From Andres Freund
Subject Re: Odd usage of errmsg_internal in bufmgr.c
Date
Msg-id aY4jZ-_rJR-VHAC0@alap3.anarazel.de
Whole thread Raw
In response to Re: Odd usage of errmsg_internal in bufmgr.c  (Álvaro Herrera <alvherre@kurilemu.de>)
List pgsql-hackers
Hi,

On 2026-02-12 18:53:34 +0100, Álvaro Herrera wrote:
> 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?

It's relevant for IOs that are larger than one block. E.g. you could have an
IO reading in three blocks, where there are checksum errors on the second and
third block, but the first block is OK. Or just one checksum error in a 16
block IO.

Because the error can be detected e.g. in an IO worker, we have to encode
information about the error in a dense way, since it has to be forwarded
through shared memory. Reporting the number of invalid pages / checksum
failures / zeroed pages, and the first affected block seemed a decent
compromise between space and precision.

Greetings,

Andres Freund



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: pgsql: Add file_extend_method=posix_fallocate,write_zeros.
Next
From: Álvaro Herrera
Date:
Subject: Re: Odd usage of errmsg_internal in bufmgr.c