Improve error context after some failed XLogReadRecord()

Michael Paquier <michael@paquier.xyz>

From: Michael Paquier <michael@paquier.xyz>
To: Postgres hackers <pgsql-hackers@lists.postgresql.org>
Date: 2021-11-09T01:47:11Z
Lists: pgsql-hackers

Attachments

Hi all,

I have noticed $subject while looking at a patch in this area:
https://www.postgresql.org/message-id/YYiqxtEqhgb5gIWL@paquier.xyz

While we don't expect the four callers of XLogReadRecord() related to
logical decoding to fail in the code paths changed by the patch
attached, I think that it would be good to provide more context to
users rather than just emitting an elog(ERROR) coming directly from
the WAL reader.  This way, it becomes a bit easier to guess from where
the failure is coming.

A patch is attached to improve all those elog()s.  I have tried not to
be too fancy about those new error strings, but I am sure that these
could be tweaked.

Thoughts?
--
Michael

Commits

  1. Improve error messages for some callers of XLogReadRecord()