Fix incorrect LSNs in WAL decoding error messages

Commit 3f1ce97346 introduced a circular WAL decoding buffer,
allowing records to be decoded before they are consumed. However,
decoding error messages continued to report the location of the last
record consumed instead of the record that failed decoding. With
recovery prefetching, the reported location could be many records
behind the failing record, making WAL problems harder to diagnose.

Fix this by reporting the location of the record being decoded.
Errors now identify the failing record even with recovery prefetching,
making it easier to investigate malformed WAL during recovery or with
tools such as pg_waldump and pg_walinspect.

Backpatch to v15, where the WAL decoding buffer was introduced.

Author: Rahul Yadav <[email protected]>
Reviewed-by: Surya Poondla <[email protected]>
Reviewed-by: Fujii Masao <[email protected]>
Discussion: https://postgr.es/m/[email protected]
Backpatch-through: 15

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/01b3d24c41629c577ca172f3077ec7bfc2ca9bf3

Modified Files
--------------
src/backend/access/transam/xlogreader.c | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)

Reply via email to