Re: Eagerly evict bulkwrite strategy ring
Melanie Plageman <melanieplageman@gmail.com>
From: Melanie Plageman <melanieplageman@gmail.com>
To: Chao Li <li.evan.chao@gmail.com>
Cc: Nazir Bilal Yavuz <byavuz81@gmail.com>,
Kirill Reshke <reshkekirill@gmail.com>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>,
Andres Freund <andres@anarazel.de>
Date: 2025-11-19T22:32:17Z
Lists: pgsql-hackers
Attachments
- v8-0001-Refactor-goto-into-for-loop-in-GetVictimBuffer.patch (text/x-patch) patch v8-0001
- v8-0002-Split-FlushBuffer-into-two-parts.patch (text/x-patch) patch v8-0002
- v8-0003-Eagerly-flush-bulkwrite-strategy-ring.patch (text/x-patch) patch v8-0003
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 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