Re: Incorrect logic in XLogNeedsFlush()

Melanie Plageman <melanieplageman@gmail.com>

From: Melanie Plageman <melanieplageman@gmail.com>
To: Jeff Davis <pgsql@j-davis.com>
Cc: Dilip Kumar <dilipbalaut@gmail.com>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>, Andres Freund <andres@anarazel.de>
Date: 2025-09-10T15:12:11Z
Lists: pgsql-hackers
On Tue, Sep 9, 2025 at 9:50 PM Jeff Davis <pgsql@j-davis.com> wrote:
>
> On Tue, 2025-09-09 at 16:29 -0400, Melanie Plageman wrote:
>
> > Though, it seems like LocalMinRecoveryPoint must be getting
> > incorrectly set elsewhere, otherwise this would have guarded us from
> > examining the control file:
>
> I am confused about whether we are discussing "incorrect" or "invalid".

I meant incorrect as in when it was not supposed to be -- not InvalidXLogRecPtr.

But, I've realized I misspoke -- because InRecovery is only true in
the startup process, so

        if (XLogRecPtrIsInvalid(LocalMinRecoveryPoint) && InRecovery)

is false for checkpointer.

- Melanie



Commits

  1. Reorder XLogNeedsFlush() checks to be more consistent

  2. Make XLogFlush() and XLogNeedsFlush() decision-making more consistent