Re: Checkpointer write combining

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>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Andres Freund <andres(at)anarazel(dot)de>
Subject: Re: Checkpointer write combining
Date: 2025-11-18 18:49:28
Message-ID: CAAKRu_ZfneK9hEQs-ht2696aJ3ZSJs1c_-rXzBmyKjPDYRnqgA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Nov 13, 2025 at 3:30 AM Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com> wrote:
>
> > On Nov 4, 2025, at 07:34, Melanie Plageman <melanieplageman(at)gmail(dot)com> wrote:
> >
> >
> > uint32
> > StrategyMaxWriteBatchSize(BufferAccessStrategy strategy)
> > {
> > uint32 max_write_batch_size = Min(io_combine_limit,
> > MAX_IO_COMBINE_LIMIT);
> > int strategy_pin_limit = GetAccessStrategyPinLimit(strategy);
> > uint32 max_possible_buffer_limit = GetPinLimit();
> >
> > /* Identify the minimum of the above */
> > max_write_batch_size = Min(strategy_pin_limit, max_write_batch_size);
> > max_write_batch_size = Min(max_possible_buffer_limit, max_write_batch_size);
> >
> > /* Must allow at least 1 IO for forward progress */
> > max_write_batch_size = Max(1, max_write_batch_size);
> >
> > return max_write_batch_size;
> > }
> >
> > Is this better?
>
> Yes, I think your version is safer because it enforces the max limit at runtime instead of only asserting it in debug builds.

Cool. I've attached a v9 which is rebased over recent bufmgr.c
changes. In the process, I found a bit of cleanup to do.

> I quickly went through 0001-0006, looks good to me now. As 0007 has WIP in the subject, I skipped it.

I no longer remember why I made that patch WIP, so I've removed that
designation.

- Melanie

Attachment Content-Type Size
v9-0001-Refactor-goto-into-for-loop-in-GetVictimBuffer.patch text/x-patch 12.2 KB
v9-0002-Split-FlushBuffer-into-two-parts.patch text/x-patch 7.7 KB
v9-0003-Eagerly-flush-bulkwrite-strategy-ring.patch text/x-patch 12.7 KB
v9-0004-Write-combining-for-BAS_BULKWRITE.patch text/x-patch 16.4 KB
v9-0005-Add-database-Oid-to-CkptSortItem.patch text/x-patch 1.9 KB
v9-0006-Implement-checkpointer-data-write-combining.patch text/x-patch 10.9 KB
v9-0007-Refactor-SyncOneBuffer-for-bgwriter-use-only.patch text/x-patch 5.9 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Sami Imseih 2025-11-18 18:49:45 Re: pg_utility ?
Previous Message Roman Khapov 2025-11-18 18:46:15 Re: *_LAST in enums to define NUM* macross