mirror of
https://github.com/postgres/postgres.git
synced 2025-06-17 17:02:08 +03:00
Simplify some maths in xlogreader.c
An LSN was calculated from a segment number, a segment size and a position offset, matching exactly the LSN given by the caller of XLogReaderValidatePageHeader(). This change removes the extra LSN calculation, relying only on the LSN given by the function caller instead. Author: Bharath Rupireddy Reviewed-by: Richard Guo, Álvaro Herrera, Kyotaro Horiguchi Discussion: https://postgr.es/m/CALj2ACXuh4Ms9j9sxMYdtHEe=5sFcyrs-GAHyADu_A_G71kZTg@mail.gmail.com
This commit is contained in:
@ -1210,7 +1210,6 @@ bool
|
||||
XLogReaderValidatePageHeader(XLogReaderState *state, XLogRecPtr recptr,
|
||||
char *phdr)
|
||||
{
|
||||
XLogRecPtr recaddr;
|
||||
XLogSegNo segno;
|
||||
int32 offset;
|
||||
XLogPageHeader hdr = (XLogPageHeader) phdr;
|
||||
@ -1220,8 +1219,6 @@ XLogReaderValidatePageHeader(XLogReaderState *state, XLogRecPtr recptr,
|
||||
XLByteToSeg(recptr, segno, state->segcxt.ws_segsize);
|
||||
offset = XLogSegmentOffset(recptr, state->segcxt.ws_segsize);
|
||||
|
||||
XLogSegNoOffsetToRecPtr(segno, offset, state->segcxt.ws_segsize, recaddr);
|
||||
|
||||
if (hdr->xlp_magic != XLOG_PAGE_MAGIC)
|
||||
{
|
||||
char fname[MAXFNAMELEN];
|
||||
@ -1296,7 +1293,7 @@ XLogReaderValidatePageHeader(XLogReaderState *state, XLogRecPtr recptr,
|
||||
* check typically fails when an old WAL segment is recycled, and hasn't
|
||||
* yet been overwritten with new data yet.
|
||||
*/
|
||||
if (hdr->xlp_pageaddr != recaddr)
|
||||
if (hdr->xlp_pageaddr != recptr)
|
||||
{
|
||||
char fname[MAXFNAMELEN];
|
||||
|
||||
|
Reference in New Issue
Block a user