Re: Checkpointer write combining

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>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>, Andres Freund <andres@anarazel.de>
Date: 2025-11-18T18:49:28Z
Lists: pgsql-hackers

Attachments

On Thu, Nov 13, 2025 at 3:30 AM Chao Li <li.evan.chao@gmail.com> wrote:
>
> > On Nov 4, 2025, at 07:34, Melanie Plageman <melanieplageman@gmail.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