pgsql: pg_waldump: Align WAL read error locations with other tools

From: Fujii Masao <fujii(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: pg_waldump: Align WAL read error locations with other tools
Date: 2026-11-03 01:53:27
Message-ID: E1xO3iJ-00000001sTA-2A7e@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

pg_waldump: Align WAL read error locations with other tools

When reading WAL fails, pg_rewind and pg_walinspect report the
position where the failed read began, followed by the detailed error
message. In contrast, pg_waldump's "error in WAL record at ..."
prefix reported the position of the last successfully read record.
This was misleading because the prefix pointed to a successfully
read record rather than the start of the failed read.

Make pg_waldump report the position where the failed read began,
consistent with pg_rewind and pg_walinspect.

Note that this position usually identifies the start of the next
record, but may precede it when a page header must be skipped.
It may also differ from the actual error location when reading
a record that spans multiple pages. Nevertheless, it is consistent
with the other tools and less misleading than reporting the last
successfully read record.

Author: Rahul Yadav <rahul(at)rhyadav(dot)dev>
Reviewed-by: Surya Poondla <suryapoondla4(at)gmail(dot)com>
Reviewed-by: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
Discussion: https://postgr.es/m/P2qIkq4--F-9@rhyadav.dev

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/30faf13889b14e1bdfd0b5883291f3297135ce02

Modified Files
--------------
src/bin/pg_waldump/pg_waldump.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Fujii Masao 2026-11-03 01:53:45 pgsql: Fix incorrect LSNs in WAL decoding error messages
Previous Message Richard Guo 2026-11-03 00:52:30 pgsql: Make Memoize cache keys only of Params from outer query levels