aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Paquier <michael@paquier.xyz>2022-10-12 09:59:36 +0900
committerMichael Paquier <michael@paquier.xyz>2022-10-12 09:59:36 +0900
commita1176c67c42cf687675be762ebb6075e092d3d0a (patch)
tree58f7d47c95879cec9fd9416ca21c91dc6bc86d62
parent94fd253d561bcc1db067d04f75fc1f34c3b9962f (diff)
downloadpostgresql-a1176c67c42cf687675be762ebb6075e092d3d0a.tar.gz
postgresql-a1176c67c42cf687675be762ebb6075e092d3d0a.zip
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
-rw-r--r--src/backend/access/transam/xlogreader.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/src/backend/access/transam/xlogreader.c b/src/backend/access/transam/xlogreader.c
index 5a8fe81f826..93f667b2544 100644
--- a/src/backend/access/transam/xlogreader.c
+++ b/src/backend/access/transam/xlogreader.c
@@ -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];