From: | Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com> |
---|---|
To: | Richard Guo <guofenglinux(at)gmail(dot)com> |
Cc: | Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org |
Subject: | Re: Remove an unnecessary LSN calculation while validating WAL page header |
Date: | 2022-10-11 11:04:58 |
Message-ID: | CALj2ACUU-q_uk+i9soRf7NkXk2Yh9fXnuqdOxo=gJocH40NM_A@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Tue, Oct 11, 2022 at 3:19 PM Richard Guo <guofenglinux(at)gmail(dot)com> wrote:
>
>
> On Tue, Oct 11, 2022 at 1:44 PM Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com> wrote:
>>
>> 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.
>
>
> +1. This should be introduced in 7fcbf6a4 as a thinko. A grep search
> shows other callers of XLogSegNoOffsetToRecPtr have no such issue.
Thanks for reviewing. It's a pretty-old code that exists in 9.5 or
earlier [1], definitely not introduced by 7fcbf6a4.
[1] see XLogReaderValidatePageHeader() in
https://github.com/BRupireddy/postgres/blob/REL9_5_STABLE/src/backend/access/transam/xlogreader.c
--
Bharath Rupireddy
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com
From | Date | Subject | |
---|---|---|---|
Next Message | Bharath Rupireddy | 2022-10-11 11:06:34 | Re: ps command does not show walsender's connected db |
Previous Message | Alvaro Herrera | 2022-10-11 10:57:06 | Re: create subscription - improved warning message |