Re: Remove an unnecessary LSN calculation while validating WAL page header - Mailing list pgsql-hackers

From Richard Guo
Subject Re: Remove an unnecessary LSN calculation while validating WAL page header
Date
Msg-id CAMbWs4_rEJ67WPiELY+dwGa=-XWbN44Gko2PbQi7XvsEoAHNGA@mail.gmail.com
Whole thread Raw
In response to Re: Remove an unnecessary LSN calculation while validating WAL page header  (Kyotaro Horiguchi <horikyota.ntt@gmail.com>)
Responses Re: Remove an unnecessary LSN calculation while validating WAL page header  (Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>)
List pgsql-hackers

On Tue, Oct 11, 2022 at 1:44 PM Kyotaro Horiguchi <horikyota.ntt@gmail.com> wrote:
At Mon, 10 Oct 2022 08:53:55 +0530, Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.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.
 
+1. This should be introduced in 7fcbf6a4 as a thinko. A grep search
shows other callers of XLogSegNoOffsetToRecPtr have no such issue.

Thanks
Richard

pgsql-hackers by date:

Previous
From: jiye
Date:
Subject: Is there any plan to support online schem change in postgresql?
Next
From: hubert depesz lubaczewski
Date:
Subject: Re: Is there any plan to support online schem change in postgresql?