pgsql: Add io_direct setting (developer-only).

Поиск
Список
Период
Сортировка
Искать

pgsql: Add io_direct setting (developer-only).

От:
Thomas Munro <tmunro@postgresql.org>
Дата:
Add io_direct setting (developer-only).

Provide a way to ask the kernel to use O_DIRECT (or local equivalent)
where available for data and WAL files, to avoid or minimize kernel
caching.  This hurts performance currently and is not intended for end
users yet.  Later proposed work would introduce our own I/O clustering,
read-ahead, etc to replace the facilities the kernel disables with this
option.

The only user-visible change, if the developer-only GUC is not used, is
that this commit also removes the obscure logic that would activate
O_DIRECT for the WAL when wal_sync_method=open_[data]sync and
wal_level=minimal (which also requires max_wal_senders=0).  Those are
non-default and unlikely settings, and this behavior wasn't (correctly)
documented.  The same effect can be achieved with io_direct=wal.

Author: Thomas Munro 
Author: Andres Freund 
Author: Bharath Rupireddy 
Reviewed-by: Justin Pryzby 
Reviewed-by: Bharath Rupireddy 
Discussion: https://postgr.es/m/CA%2BhUKGK1X532hYqJ_MzFWt0n1zt8trz980D79WbjwnT-yYLZpg%40mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/d4e71df6d757fd21c363164a3a4d3b5681462662

Modified Files
--------------
doc/src/sgml/config.sgml                      | 33 ++++++++-
src/backend/access/transam/xlog.c             | 37 +++++-----
src/backend/access/transam/xlogprefetcher.c   |  2 +-
src/backend/storage/buffer/bufmgr.c           | 16 +++--
src/backend/storage/buffer/localbuf.c         |  7 +-
src/backend/storage/file/fd.c                 | 98 +++++++++++++++++++++++++++
src/backend/storage/smgr/md.c                 | 24 +++++--
src/backend/storage/smgr/smgr.c               |  1 +
src/backend/utils/misc/guc_tables.c           | 12 ++++
src/include/storage/fd.h                      |  7 ++
src/include/storage/smgr.h                    |  1 +
src/include/utils/guc_hooks.h                 |  2 +
src/test/modules/test_misc/meson.build        |  1 +
src/test/modules/test_misc/t/004_io_direct.pl | 57 ++++++++++++++++
14 files changed, 263 insertions(+), 35 deletions(-)

FAQ