Re: Eagerly evict bulkwrite strategy ring

From: Melanie Plageman <melanieplageman(at)gmail(dot)com>
To: Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>
Cc: Nazir Bilal Yavuz <byavuz81(at)gmail(dot)com>, Kirill Reshke <reshkekirill(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Andres Freund <andres(at)anarazel(dot)de>
Subject: Re: Eagerly evict bulkwrite strategy ring
Date: 2025-11-19 22:32:17
Message-ID: CAAKRu_ZxwF-Ooe=oBt8j600amEVjYVa0ES498AT=x1v8ruGNCw@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Nov 18, 2025 at 8:46 PM Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com> wrote:
>
>
> When XLogNeedsFlush(lsn) is true, StrategyRejectBuffer returns false, thus no retry will happen, which is different from the 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 Content-Type Size
v8-0001-Refactor-goto-into-for-loop-in-GetVictimBuffer.patch text/x-patch 12.2 KB
v8-0002-Split-FlushBuffer-into-two-parts.patch text/x-patch 7.7 KB
v8-0003-Eagerly-flush-bulkwrite-strategy-ring.patch text/x-patch 12.7 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Thomas Munro 2025-11-19 22:43:53 Re: PRI?64 vs Visual Studio (2022)
Previous Message Tom Lane 2025-11-19 22:23:53 Re: PRI?64 vs Visual Studio (2022)