Re: XLogBeginRead's header comment lies

From: Dilip Kumar <dilipbalaut(at)gmail(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: XLogBeginRead's header comment lies
Date: 2022-08-17 10:52:52
Message-ID: CAFiTN-vK10wesMwZgbcGOgGOEeTQ-XzQ45BuAUxwa0ErxmsceQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Aug 17, 2022 at 11:31 AM Dilip Kumar <dilipbalaut(at)gmail(dot)com> wrote:
>
> On Wed, Aug 17, 2022 at 11:18 AM Dilip Kumar <dilipbalaut(at)gmail(dot)com> wrote:
> >
> > On Tue, Aug 16, 2022 at 11:28 PM Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
> > >
> >
> > Yeah I think it makes sense to make it work as per the comment in
> > XLogBeginRecord(). I think if we modify the Assert as per the comment
> > of XLogBeginRecord() then the remaining code of the
> > XLogDecodeNextRecord() is capable enough to take care of skipping the
> > page header if we are pointing at the beginning of the block.
> >
> > See attached patch.
> >
>
> I think that is not sufficient, if there is a record continuing from
> the previous page and we are pointing to the start of the page then
> this assertion is not sufficient. I think if the
> targetRecOff is zero then we should additionally read the header and
> verify that XLP_FIRST_IS_CONTRECORD is not set.

Thinking again, there is already a code in XLogDecodeNextRecord() to
error out if XLP_FIRST_IS_CONTRECORD is set so probably we don't need
to do anything else and the previous patch with modified assert should
just work fine?

--
Regards,
Dilip Kumar
EnterpriseDB: http://www.enterprisedb.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2022-08-17 11:39:20 Re: Regarding availability of 32bit client drivers for postgresql 13/14
Previous Message Aleksander Alekseev 2022-08-17 09:43:29 Proposal: CREATE/ALTER DOMAIN ... STORAGE/COMPRESSION = ...