Re: Eagerly evict bulkwrite strategy ring - Mailing list pgsql-hackers

From Melanie Plageman
Subject Re: Eagerly evict bulkwrite strategy ring
Date
Msg-id CAAKRu_ZxwF-Ooe=oBt8j600amEVjYVa0ES498AT=x1v8ruGNCw@mail.gmail.com
Whole thread Raw
In response to Re: Eagerly evict bulkwrite strategy ring  (Chao Li <li.evan.chao@gmail.com>)
List pgsql-hackers
On Tue, Nov 18, 2025 at 8:46 PM Chao Li <li.evan.chao@gmail.com> wrote:
>
>
> When XLogNeedsFlush(lsn) is true, StrategyRejectBuffer returns false, thus no retry will happen, which is different
fromthe old logic, is that an intentional change? 

No, this is a mistake. You are correct. I thought I had fixed this in
an earlier version, but somehow it is still like this.
I've gone with correcting it like this (in attached v8)

    if (!XLogNeedsFlush(lsn))
        return false;

    /*
     * Remove the dirty buffer from the ring; necessary to prevent an infinite
     * loop if all ring members are dirty.
     */
    strategy->buffers[strategy->current] = InvalidBuffer;
    return true;

But perhaps the suggestion I think you made earlier is better, dunno

    if (!XLogNeedsFlush(lsn))
    {
        /*
        * Remove the dirty buffer from the ring; necessary to prevent
an infinite
        * loop if all ring members are dirty.
        */
        strategy->buffers[strategy->current] = InvalidBuffer;
        return true;
    }
    return false;

- Melanie

Attachment

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: PRI?64 vs Visual Studio (2022)
Next
From: Thomas Munro
Date:
Subject: Re: PRI?64 vs Visual Studio (2022)