Report detailed errors from XLogFindNextRecord() failures. Previously, XLogFindNextRecord() did not return detailed error information when it failed to find a valid WAL record. As a result, callers such as the WAL summarizer, pg_waldump, and pg_walinspect could only report generic errors (e.g., "could not find a valid record after ..."), making troubleshooting difficult.
This commit fix the issue by extending XLogFindNextRecord() to return detailed error information on failure, and updating its callers to include those details in their error messages. For example, when pg_waldump is run on a WAL file with an invalid magic number, it now reports not only the generic error but also the specific cause (e.g., "invalid magic number"). Author: Anthonin Bonnefoy <[email protected]> Reviewed-by: Mircea Cadariu <[email protected]> Reviewed-by: Japin Li <[email protected]> Reviewed-by: Chao Li <[email protected]> Reviewed-by: Fujii Masao <[email protected]> Discussion: https://postgr.es/m/cao6_xqoxjxddct4wkd9xd+cd6sz-fysprguv4bq-wbxg4pv...@mail.gmail.com Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/1c162c965a113192cd5137e6de38a10fbc0a5692 Modified Files -------------- contrib/pg_walinspect/pg_walinspect.c | 16 ++++++++++++---- src/backend/access/transam/xlogreader.c | 24 +++++++++++++++++++++--- src/backend/postmaster/walsummarizer.c | 17 ++++++++++++----- src/bin/pg_waldump/pg_waldump.c | 12 +++++++++--- src/bin/pg_waldump/t/001_basic.pl | 28 ++++++++++++++++++++++++++++ src/include/access/xlogreader.h | 3 ++- 6 files changed, 84 insertions(+), 16 deletions(-)
