pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Thomas Munro <tmunro@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Provide vectored variant of ReadBuffer().
Date: Tue, 02 Apr 2024 11:59:13 +0000
Message-ID: <E1rrcnJ-0007ql-D8@gemulon.postgresql.org> (raw)

Provide vectored variant of ReadBuffer().

Break ReadBuffer() up into two steps.  StartReadBuffers() and
WaitReadBuffers() give us two main advantages:

1.  Multiple consecutive blocks can be read with one system call.
2.  Advice (hints of future reads) can optionally be issued to the
kernel ahead of time.

The traditional ReadBuffer() function is now implemented in terms of
those functions, to avoid duplication.

A new GUC io_combine_limit is defined, and the functions for limiting
per-backend pin counts are made into public APIs.  Those are provided
for use by callers of StartReadBuffers(), when deciding how many buffers
to read at once.  The following commit will add a higher level mechanism
for doing that automatically with a practical interface.

With some more infrastructure in later work, StartReadBuffers() could
be extended to start real asynchronous I/O instead of just issuing
advice and leaving WaitReadBuffers() to do the work synchronously.

Author: Thomas Munro <thomas.munro@gmail.com>
Author: Andres Freund <andres@anarazel.de> (some optimization tweaks)
Reviewed-by: Melanie Plageman <melanieplageman@gmail.com>
Reviewed-by: Heikki Linnakangas <hlinnaka@iki.fi>
Reviewed-by: Nazir Bilal Yavuz <byavuz81@gmail.com>
Reviewed-by: Dilip Kumar <dilipbalaut@gmail.com>
Reviewed-by: Andres Freund <andres@anarazel.de>
Tested-by: Tomas Vondra <tomas.vondra@enterprisedb.com>
Discussion: https://postgr.es/m/CA+hUKGJkOiOCa+mag4BF+zHo7qo=o9CFheB8=g6uT5TUm2gkvA@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/210622c60e1a9db2e2730140b8106ab57d259d15

Modified Files
--------------
doc/src/sgml/config.sgml                      |  14 +
src/backend/storage/buffer/bufmgr.c           | 726 ++++++++++++++++++--------
src/backend/storage/buffer/localbuf.c         |  14 +-
src/backend/utils/misc/guc_tables.c           |  14 +
src/backend/utils/misc/postgresql.conf.sample |   1 +
src/include/storage/bufmgr.h                  |  55 ++
src/tools/pgindent/typedefs.list              |   2 +
7 files changed, 605 insertions(+), 221 deletions(-)



Message-ID: <E1rrcnJ-0007ql-D8@gemulon.postgresql.org>
Permalink:  ../E1rrcnJ-0007ql-D8@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1rrcnJ-0007ql-D8@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: tmunro@postgresql.org, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Provide vectored variant of ReadBuffer().
  In-Reply-To: <E1rrcnJ-0007ql-D8@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox