Re: Incorrect logic in XLogNeedsFlush()

From: Dilip Kumar <dilipbalaut(at)gmail(dot)com>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: Melanie Plageman <melanieplageman(at)gmail(dot)com>, Jeff Davis <pgsql(at)j-davis(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Andres Freund <andres(at)anarazel(dot)de>
Subject: Re: Incorrect logic in XLogNeedsFlush()
Date: 2025-09-24 11:58:17
Message-ID: CAFiTN-swRpG9x+h4oRwCMb+3AKhNOoWT0JUjbBO-k_b2eE0KpA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Sep 19, 2025 at 10:58 AM Michael Paquier <michael(at)paquier(dot)xyz> wrote:
>
> On Thu, Sep 18, 2025 at 05:07:00PM +0530, Dilip Kumar wrote:
> > I think this comment is a side note which is stating that it is
> > possible that while XLogNeedFlush() is deciding that based on the
> > current flush position or min recovery point parallely someone might
> > flush beyond that point. And it was existing comment which has been
> > improved by adding min recovery points, so I think it makes sense.
>
> Indeed. I have kept this one after drinking more caffeine, rewording
> it slightly.
>
> > I tried improving this comment as well. Feel free to disregard it if
> > you think it's not improving it.
>
> The new additions in XLogNeedsFlush() felt overweight, though, so I
> have kept a shorter and reworded version. Then, applied the result.

Thanks.

> Do we want to make the order of the checks to be more consistent in
> both routines? These would require a separate set of double-checks
> and review, but while we're looking at this area of the code we may as
> tweak it more..

I see both routines have the same order i.e. first check if
(!XLogInsertAllowed()) and then if (record <= LogwrtResult.Flush),
what am I missing?

--
Regards,
Dilip Kumar
Google

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Ashutosh Bapat 2025-09-24 11:58:44 Re: Report bytes and transactions actually sent downtream
Previous Message Christoph Berg 2025-09-24 11:51:50 Re: "openssl" should not be optional