Re: Incorrect logic in XLogNeedsFlush()

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Jeff Davis <pgsql(at)j-davis(dot)com>
Cc: Melanie Plageman <melanieplageman(at)gmail(dot)com>, Dilip Kumar <dilipbalaut(at)gmail(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-10 23:21:21
Message-ID: aMIH8RmMc5-8YzoI@paquier.xyz
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2025-09-10 23:28:35 Re: BF mamba failure
Previous Message Michael Paquier 2025-09-10 23:18:13 Re: Incorrect logic in XLogNeedsFlush()