Re: Incorrect logic in XLogNeedsFlush() - Mailing list pgsql-hackers

From Michael Paquier
Subject Re: Incorrect logic in XLogNeedsFlush()
Date
Msg-id aMzp0ibbduCr3jTW@paquier.xyz
Whole thread Raw
In response to Re: Incorrect logic in XLogNeedsFlush()  (Dilip Kumar <dilipbalaut@gmail.com>)
List pgsql-hackers
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.

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

Attachment

pgsql-hackers by date:

Previous
From: Chao Li
Date:
Subject: Re: Optimize multiplications/divisions by 2 using bit shifts in hot paths
Next
From: Amit Kapila
Date:
Subject: Re: Reword messages using "as" instead of "because"