aboutsummaryrefslogtreecommitdiff
path: root/src/backend/access/transam/xlogrecovery.c
diff options
context:
space:
mode:
authorMichael Paquier <michael@paquier.xyz>2022-12-05 09:28:29 +0900
committerMichael Paquier <michael@paquier.xyz>2022-12-05 09:28:29 +0900
commit71cb84ec69a38444c48bd8d3b5451b2da157848b (patch)
tree7d41c2e9d4bef261d0b265c3841e4936a40dc8fd /src/backend/access/transam/xlogrecovery.c
parent8692f6644e71f51db9a853a652f37909c9cb534d (diff)
downloadpostgresql-71cb84ec69a38444c48bd8d3b5451b2da157848b.tar.gz
postgresql-71cb84ec69a38444c48bd8d3b5451b2da157848b.zip
Add LSN location in some error messages related to WAL pages
The error messages reported during any failures while reading or validating the header of a WAL currently includes only the offset of the page but not the compiled LSN referring to the page, requiring an extra step to compile it if looking at the surroundings with pg_waldump or similar. Adding this information costs a bit in translation, but also eases debugging. Author: Bharath Rupireddy Reviewed-by: Álvaro Herrera, Kyotaro Horiguchi, Maxim Orlov, Michael Paquier Discussion: https://postgr.es/m/CALj2ACWV=FCddsxcGbVOA=cvPyMr75YCFbSQT6g4KDj=gcJK4g@mail.gmail.com
Diffstat (limited to 'src/backend/access/transam/xlogrecovery.c')
-rw-r--r--src/backend/access/transam/xlogrecovery.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/backend/access/transam/xlogrecovery.c b/src/backend/access/transam/xlogrecovery.c
index 41ffc57da9c..97b882564ff 100644
--- a/src/backend/access/transam/xlogrecovery.c
+++ b/src/backend/access/transam/xlogrecovery.c
@@ -3075,9 +3075,10 @@ ReadRecord(XLogPrefetcher *xlogprefetcher, int emode,
XLogFileName(fname, xlogreader->seg.ws_tli, segno,
wal_segment_size);
ereport(emode_for_corrupt_record(emode, xlogreader->EndRecPtr),
- (errmsg("unexpected timeline ID %u in WAL segment %s, offset %u",
+ (errmsg("unexpected timeline ID %u in WAL segment %s, LSN %X/%X, offset %u",
xlogreader->latestPageTLI,
fname,
+ LSN_FORMAT_ARGS(xlogreader->latestPagePtr),
offset)));
record = NULL;
}
@@ -3280,14 +3281,16 @@ retry:
errno = save_errno;
ereport(emode_for_corrupt_record(emode, targetPagePtr + reqLen),
(errcode_for_file_access(),
- errmsg("could not read from WAL segment %s, offset %u: %m",
- fname, readOff)));
+ errmsg("could not read from WAL segment %s, LSN %X/%X, offset %u: %m",
+ fname, LSN_FORMAT_ARGS(targetPagePtr),
+ readOff)));
}
else
ereport(emode_for_corrupt_record(emode, targetPagePtr + reqLen),
(errcode(ERRCODE_DATA_CORRUPTED),
- errmsg("could not read from WAL segment %s, offset %u: read %d of %zu",
- fname, readOff, r, (Size) XLOG_BLCKSZ)));
+ errmsg("could not read from WAL segment %s, LSN %X/%X, offset %u: read %d of %zu",
+ fname, LSN_FORMAT_ARGS(targetPagePtr),
+ readOff, r, (Size) XLOG_BLCKSZ)));
goto next_record_is_invalid;
}
pgstat_report_wait_end();