postgres.git / summary / log / commit / refs

commit    30faf13889b14e1bdfd0b5883291f3297135ce02
Author:   Fujii Masao <fujii@postgresql.org>
Date:     Tue Nov 03 01:52:45 2026 +0000

    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@rhyadav.dev>
    Reviewed-by: Surya Poondla <suryapoondla4@gmail.com>
    Reviewed-by: Fujii Masao <masao.fujii@gmail.com>
    Discussion: https://postgr.es/m/P2qIkq4--F-9@rhyadav.dev


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 6f0574a8764..34ca41a7e6d 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); /* [parent: 01b3d24c4162]