From 27363ec05340a56435843345ac75585fb7521dfa Mon Sep 17 00:00:00 2001 From: Rahul Yadav Date: Thu, 1 Oct 2026 07:46:25 +0100 Subject: [PATCH v1 2/2] pg_waldump: Report the position of a WAL read error When reading a record fails, pg_waldump prints "error in WAL record at %X/%08X" followed by the reader's message, using ReadRecPtr for the position. ReadRecPtr is the start of the last record read successfully, not the place where reading failed. At the end of WAL, the most common case, the prefix names the last valid record while the message names the end of WAL: error in WAL record at 0/017AC370: invalid record length at 0/017AC3F8: expected at least 24, got 0 Since 3f1ce97346 the same happens when a record is rejected while it is being decoded. Use EndRecPtr instead, the position where the failing record starts, as pg_rewind already does. Author: Rahul Yadav --- src/bin/pg_waldump/pg_waldump.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bin/pg_waldump/pg_waldump.c b/src/bin/pg_waldump/pg_waldump.c index 6f0574a876..34ca41a7e6 100644 --- a/src/bin/pg_waldump/pg_waldump.c +++ b/src/bin/pg_waldump/pg_waldump.c @@ -1521,7 +1521,7 @@ main(int argc, char **argv) if (errormsg) pg_fatal("error in WAL record at %X/%08X: %s", - LSN_FORMAT_ARGS(xlogreader_state->ReadRecPtr), + LSN_FORMAT_ARGS(xlogreader_state->EndRecPtr), errormsg); /* -- 2.50.1 (Apple Git-155)