From: | Thomas Munro <tmunro(at)postgresql(dot)org> |
---|---|
To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
Subject: | pgsql: Prefetch data referenced by the WAL, take II. |
Date: | 2022-04-07 07:44:20 |
Message-ID: | E1ncMoW-000hhv-4s@gemulon.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers pgsql-hackers |
Prefetch data referenced by the WAL, take II.
Introduce a new GUC recovery_prefetch. 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. Since not all OSes have
that system call, "try" is provided so that it can be enabled where
available. Better mechanisms for asynchronous I/O are possible in later
work.
Set to "try" for now for test coverage. Default setting to be finalized
before release.
The GUC wal_decode_buffer_size limits the distance we can look ahead in
bytes of decoded data.
The existing GUC maintenance_io_concurrency is used to limit the number
of concurrent I/Os allowed, based on pessimistic heuristics used to
infer that I/Os have begun and completed. We'll also not look more than
maintenance_io_concurrency * 4 block references ahead.
Reviewed-by: Julien Rouhaud <rjuju123(at)gmail(dot)com>
Reviewed-by: Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com>
Reviewed-by: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com> (earlier version)
Reviewed-by: Andres Freund <andres(at)anarazel(dot)de> (earlier version)
Reviewed-by: Justin Pryzby <pryzby(at)telsasoft(dot)com> (earlier version)
Tested-by: Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com> (earlier version)
Tested-by: Jakub Wartak <Jakub(dot)Wartak(at)tomtom(dot)com> (earlier version)
Tested-by: Dmitry Dolgov <9erthalion6(at)gmail(dot)com> (earlier version)
Tested-by: Sait Talha Nisanci <Sait(dot)Nisanci(at)microsoft(dot)com> (earlier version)
Discussion: https://postgr.es/m/CA%2BhUKGJ4VJN8ttxScUFM8dOKX0BrBiboo5uz1cq%3DAovOddfHpA%40mail.gmail.com
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/5dc0418fab281d017a61a5756240467af982bdfd
Modified Files
--------------
doc/src/sgml/config.sgml | 64 ++
doc/src/sgml/monitoring.sgml | 86 +-
doc/src/sgml/wal.sgml | 12 +
src/backend/access/transam/Makefile | 1 +
src/backend/access/transam/xlog.c | 2 +
src/backend/access/transam/xlogprefetcher.c | 1082 +++++++++++++++++++++++++
src/backend/access/transam/xlogreader.c | 27 +-
src/backend/access/transam/xlogrecovery.c | 179 ++--
src/backend/access/transam/xlogutils.c | 27 +-
src/backend/catalog/system_views.sql | 14 +
src/backend/storage/buffer/bufmgr.c | 4 +
src/backend/storage/freespace/freespace.c | 3 +-
src/backend/storage/ipc/ipci.c | 3 +
src/backend/storage/smgr/md.c | 6 +-
src/backend/utils/adt/pgstatfuncs.c | 5 +-
src/backend/utils/misc/guc.c | 55 +-
src/backend/utils/misc/postgresql.conf.sample | 6 +
src/include/access/xlog.h | 1 +
src/include/access/xlogprefetcher.h | 53 ++
src/include/access/xlogreader.h | 8 +
src/include/access/xlogutils.h | 3 +-
src/include/catalog/catversion.h | 2 +-
src/include/catalog/pg_proc.dat | 7 +
src/include/utils/guc.h | 4 +
src/include/utils/guc_tables.h | 1 +
src/test/regress/expected/rules.out | 11 +
src/tools/pgindent/typedefs.list | 6 +
27 files changed, 1595 insertions(+), 77 deletions(-)
From | Date | Subject | |
---|---|---|---|
Next Message | Andres Freund | 2022-04-07 07:59:09 | pgsql: pgstat: add alternate output for stats.spec, for the 2PC disable |
Previous Message | Michael Paquier | 2022-04-07 07:42:50 | Re: pgsql: pgstat: store statistics in shared memory. |
From | Date | Subject | |
---|---|---|---|
Next Message | Thomas Munro | 2022-04-07 07:45:23 | Re: WIP: WAL prefetch (another approach) |
Previous Message | Gunnar "Nick" Bluth | 2022-04-07 07:43:22 | Re: [PATCH] pg_stat_toast |