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: Add io_direct setting (developer-only).
Date: Sat, 08 Apr 2023 04:35:13 +0000
Message-ID: <E1pl0IC-001z11-2Z@gemulon.postgresql.org> (raw)

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 <thomas.munro@gmail.com>
Author: Andres Freund <andres@anarazel.de>
Author: Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Reviewed-by: Justin Pryzby <pryzby@telsasoft.com>
Reviewed-by: Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
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(-)



Message-ID: <E1pl0IC-001z11-2Z@gemulon.postgresql.org>
Permalink:  ../E1pl0IC-001z11-2Z@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1pl0IC-001z11-2Z@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: Add io_direct setting (developer-only).
  In-Reply-To: <E1pl0IC-001z11-2Z@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