Remove an unnecessary LSN calculation while validating WAL page header

From: Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Remove an unnecessary LSN calculation while validating WAL page header
Date: 2022-10-10 03:23:55
Message-ID: CALj2ACXuh4Ms9j9sxMYdtHEe=5sFcyrs-GAHyADu_A_G71kZTg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

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'.

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

--
Bharath Rupireddy
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com

Attachment Content-Type Size
v1-0001-Remove-an-unnecessary-LSN-calculation-while-valid.patch application/x-patch 1.5 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bharath Rupireddy 2022-10-10 03:27:31 Re: ps command does not show walsender's connected db
Previous Message Julien Rouhaud 2022-10-10 02:51:32 Re: Allow file inclusion in pg_hba and pg_ident files