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: Optionally prefetch referenced data in recovery.
Date: Thu, 08 Apr 2021 11:23:10 +0000
Message-ID: <E1lUSkg-0007xN-Cx@gemulon.postgresql.org> (raw)

Optionally prefetch referenced data in recovery.

Introduce a new GUC recovery_prefetch, disabled by default.  When
enabled, look ahead in the WAL and try to initiate asynchronous reading
of referenced data blocks that are not yet cached in our buffer pool.
For now, this is done with posix_fadvise(), which has several caveats.
Better mechanisms will follow in later work on the I/O subsystem.

The GUC maintenance_io_concurrency is used to limit the number of
concurrent I/Os we allow ourselves to initiate, based on pessimistic
heuristics used to infer that I/Os have begun and completed.

The GUC wal_decode_buffer_size is used to limit the maximum distance we
are prepared to read ahead in the WAL to find uncached blocks.

Reviewed-by: Alvaro Herrera <alvherre@2ndquadrant.com> (parts)
Reviewed-by: Andres Freund <andres@anarazel.de> (parts)
Reviewed-by: Tomas Vondra <tomas.vondra@2ndquadrant.com> (parts)
Tested-by: Tomas Vondra <tomas.vondra@2ndquadrant.com>
Tested-by: Jakub Wartak <Jakub.Wartak@tomtom.com>
Tested-by: Dmitry Dolgov <9erthalion6@gmail.com>
Tested-by: Sait Talha Nisanci <Sait.Nisanci@microsoft.com>
Discussion: https://postgr.es/m/CA%2BhUKGJ4VJN8ttxScUFM8dOKX0BrBiboo5uz1cq%3DAovOddfHpA%40mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/1d257577e08d3e598011d6850fd1025858de8c8c

Modified Files
--------------
doc/src/sgml/config.sgml                      |  83 +++
doc/src/sgml/monitoring.sgml                  |  86 ++-
doc/src/sgml/wal.sgml                         |  17 +
src/backend/access/transam/Makefile           |   1 +
src/backend/access/transam/xlog.c             |  50 +-
src/backend/access/transam/xlogprefetch.c     | 922 ++++++++++++++++++++++++++
src/backend/access/transam/xlogreader.c       |  13 +
src/backend/access/transam/xlogutils.c        |  23 +-
src/backend/catalog/system_views.sql          |  14 +
src/backend/postmaster/pgstat.c               | 103 ++-
src/backend/storage/freespace/freespace.c     |   3 +-
src/backend/storage/ipc/ipci.c                |   3 +
src/backend/utils/misc/guc.c                  |  51 +-
src/backend/utils/misc/postgresql.conf.sample |   6 +
src/include/access/xlog.h                     |   1 +
src/include/access/xlogprefetch.h             |  82 +++
src/include/access/xlogreader.h               |   7 +
src/include/access/xlogutils.h                |   3 +-
src/include/catalog/pg_proc.dat               |   8 +
src/include/pgstat.h                          |  26 +
src/include/utils/guc.h                       |   4 +
src/test/regress/expected/rules.out           |  11 +
src/tools/pgindent/typedefs.list              |   4 +
23 files changed, 1502 insertions(+), 19 deletions(-)



Message-ID: <E1lUSkg-0007xN-Cx@gemulon.postgresql.org>
Permalink:  ../E1lUSkg-0007xN-Cx@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1lUSkg-0007xN-Cx@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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: tmunro@postgresql.org
  Subject: Re: pgsql: Optionally prefetch referenced data in recovery.
  In-Reply-To: <E1lUSkg-0007xN-Cx@gemulon.postgresql.org>
  References: <E1lUSkg-0007xN-Cx@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