Hi
On 2026-02-12 20:16:52 +0100, Álvaro Herrera wrote:
> 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).
Not the messages, but the emission of it does have plenty repetition, with a
branch for zeroed_or_error_count == 1 and otherwise, the ereport etc.
I apparently may be alone in this, but I find 6 repetitions of ereports, with
differently indented messages and arguments, depending on whether it's an
errmsg, errdetails, errhint way harder to scan and modify than something that
just shows the different messages with consistent indentation.
> 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?
buffer_readv_complete_one(), which does the per-buffer processing for,
possibly larger, IO:
/*
* Immediately log a message about the invalid page, but only
to the
* server log. The reason to do so immediately is that this may
be
* executed in a different backend than the one that originated
the
* request. The reason to do so immediately is that the
originator
* might not process the query result immediately (because it
is busy
* doing another part of query processing) or at all (e.g. if
it was
* cancelled or errored out due to another IO also failing). The
* definer of the IO will emit an ERROR or WARNING when
processing the
* IO's results
*
* To avoid duplicating the code to emit these log messages, we
reuse
* buffer_readv_report().
*/
(hm, there's a repeated "The reason to do so immediately is" that should just
be an "and")
> [ ... some cscope jumping later ... ] Is it md_readv_report?
No, that's for the IO failing in its entirety.
Greetings,
Andres Freund