Re: Remove an unnecessary LSN calculation while validating WAL page header

From: Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>
To: bharath(dot)rupireddyforpostgres(at)gmail(dot)com
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Remove an unnecessary LSN calculation while validating WAL page header
Date: 2022-10-11 05:43:59
Message-ID: 20221011.144359.1956243431819710211.horikyota.ntt@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

At Mon, 10 Oct 2022 08:53:55 +0530, Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com> wrote in
> It looks like we have an unnecessary XLogSegNoOffsetToRecPtr() in
> XLogReaderValidatePageHeader(). We pass the start LSN of the WAL page
> and check if it matches with the LSN that was stored in the WAL page
> header (xlp_pageaddr). We find segno, offset and LSN again using
> XLogSegNoOffsetToRecPtr(). This happens to be the same as the passed
> in LSN 'recptr'.

Yeah, that's obviously useless. It looks like a thinko in pg93 when
recptr became to be directly passed from the caller instead of
calculating from static variables for file, segment and in-segment
offset.

> Here's a tiny patch removing the unnecessary XLogSegNoOffsetToRecPtr()
> and using the passed in 'recptr'.

Looks good to me.

# Mysteriously, I didn't find a code to change readId in the pg92 tree..

regards.

--
Kyotaro Horiguchi
NTT Open Source Software Center

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2022-10-11 05:49:00 Re: src/test/perl/PostgreSQL/Test/*.pm not installed
Previous Message Ashutosh Bapat 2022-10-11 05:31:23 Re: PostgreSQL Logical decoding