Re: Allow io_combine_limit up to 1MB

Thomas Munro <thomas.munro@gmail.com>

From: Thomas Munro <thomas.munro@gmail.com>
To: Andres Freund <andres@anarazel.de>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>, Tomas Vondra <tomas@vondra.me>
Date: 2025-03-03T08:11:00Z
Lists: pgsql-hackers

Attachments

On Wed, Feb 12, 2025 at 3:24 PM Thomas Munro <thomas.munro@gmail.com> wrote:
> On Wed, Feb 12, 2025 at 3:22 PM Andres Freund <andres@anarazel.de> wrote:
> > On 2025-02-12 13:59:21 +1300, Thomas Munro wrote:
> > > How about just maintaining it in a new variable
> > > effective_io_combine_limit, whenever either of them is assigned?
> >
> > Yea, that's probably the least bad way.
> >
> > I wonder if we should just name that variable io_combine_limit and have the
> > GUC be _raw or _guc or such? There's gonna be a fair number of references to
> > the variable in code...
>
> Alternatively, we could compute that as stream->io_combine_limit and
> use that.  That has the advantage that it's fixed for the life of the
> stream, even if you change it (eg between fetches from a CURSOR that
> has streams).  Pretty sure it won't break anything today,

Unfortunately that turned out to be untrue.  :-(  0001 is a patch to
address that, which should be back-patched.  It's hard to come up with
a repro for an actual problem, but I'm sure it's possible, will try...

0002 and 0003 are new versions of the patches to add
max_io_combine_limit and increase MAX_IO_COMBINE_LIMIT to 1MB.  This
time using the name io_combine_limit_guc, so that io_combine_limit
remains as the name referred to in the rest of the tree.  I
imagine/hope that we'll one day figure out how to make at least the
easy case (?) of dependencies on PGC_POSTMASTER GUCs work for
PGC_USERSET values, and then io_combine_limit_guc could be deleted...

Commits

  1. Fix bug allowing io_combine_limit > io_max_combine_combine limit

  2. Increase io_combine_limit range to 1MB.

  3. Introduce io_max_combine_limit.

  4. Fix read_stream.c for changing io_combine_limit.