mirror of
https://github.com/postgres/postgres.git
synced 2025-08-24 09:27:52 +03:00
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
This commit is contained in:
@@ -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();
|
||||
|
Reference in New Issue
Block a user