Re: Incorrect logic in XLogNeedsFlush()

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Dilip Kumar <dilipbalaut(at)gmail(dot)com>
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-19 05:27:46
Message-ID: aMzp0ibbduCr3jTW@paquier.xyz
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2025-09-19 05:50:35 Re: Reword messages using "as" instead of "because"
Previous Message Chao Li 2025-09-19 03:56:57 Re: Optimize multiplications/divisions by 2 using bit shifts in hot paths