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

From Dilip Kumar
Subject Re: Incorrect logic in XLogNeedsFlush()
Date
Msg-id CAFiTN-tpH9jPq5Qi40LYSATZsjZq_axZ-DPrO-RUYmsbHta3Qg@mail.gmail.com
Whole thread Raw
In response to Re: Incorrect logic in XLogNeedsFlush()  (Michael Paquier <michael@paquier.xyz>)
Responses Re: Incorrect logic in XLogNeedsFlush()
List pgsql-hackers
On Thu, Sep 11, 2025 at 4:51 AM Michael Paquier <michael@paquier.xyz> wrote:
>
> On Wed, Sep 10, 2025 at 09:58:08AM -0700, Jeff Davis wrote:
> > It seems like XLogFlush() and XLogNeedsFlush() should use the same
> > test, otherwise you could always get some confusing inconsistency.
> > Right?
>
> Even if the checks are duplicated (dependency could be documented as
> well), it would make sense to me to plant a check of XLogNeedsFlush()
> inside XLogFlush(), I think.  I have not tried if some parts of the
> tests blow up when trying to do that even after switching
> XLogNeedsFlush() to check if WAL inserts are allowed rather than if we
> are in recovery.

+1, it really makes XLogFlush() to directly check using
XLogNeedsFlush() after adding the "WAL inserts are allowed" check in
XLogNeedsFlush(), this is the best way to avoid any inconsistencies in
future as well.

--
Regards,
Dilip Kumar
Google



pgsql-hackers by date:

Previous
From: Peter Geoghegan
Date:
Subject: Re: PostgreSQL 18 GA press release draft
Next
From: Dilip Kumar
Date:
Subject: Re: Incorrect logic in XLogNeedsFlush()