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: Defer flushing of SLRU files.
Date: Fri, 25 Sep 2020 07:05:12 +0000
Message-ID: <E1kLhn6-0006gM-6i@gemulon.postgresql.org> (raw)

Defer flushing of SLRU files.

Previously, we called fsync() after writing out individual pg_xact,
pg_multixact and pg_commit_ts pages due to cache pressure, leading to
regular I/O stalls in user backends and recovery.  Collapse requests for
the same file into a single system call as part of the next checkpoint,
as we already did for relation files, using the infrastructure developed
by commit 3eb77eba.  This can cause a significant improvement to
recovery performance, especially when it's otherwise CPU-bound.

Hoist ProcessSyncRequests() up into CheckPointGuts() to make it clearer
that it applies to all the SLRU mini-buffer-pools as well as the main
buffer pool.  Rearrange things so that data collected in CheckpointStats
includes SLRU activity.

Also remove the Shutdown{CLOG,CommitTS,SUBTRANS,MultiXact}() functions,
because they were redundant after the shutdown checkpoint that
immediately precedes them.  (I'm not sure if they were ever needed, but
they aren't now.)

Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us> (parts)
Tested-by: Jakub Wartak <Jakub.Wartak@tomtom.com>
Discussion: https://postgr.es/m/CA+hUKGLJ=84YT+NvhkEEDAuUtVHMfQ9i-N7k_o50JmQ6Rpj_OQ@mail.gmail.com

Branch
------
master

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

Modified Files
--------------
src/backend/access/transam/clog.c      |  40 ++++-----
src/backend/access/transam/commit_ts.c |  36 ++++----
src/backend/access/transam/multixact.c |  57 ++++++------
src/backend/access/transam/slru.c      | 154 +++++++++++++++++++++++----------
src/backend/access/transam/subtrans.c  |  25 +-----
src/backend/access/transam/xlog.c      |  28 +++---
src/backend/commands/async.c           |   5 +-
src/backend/storage/buffer/bufmgr.c    |   7 --
src/backend/storage/lmgr/predicate.c   |   8 +-
src/backend/storage/sync/sync.c        |  28 +++++-
src/include/access/clog.h              |   3 +
src/include/access/commit_ts.h         |   3 +
src/include/access/multixact.h         |   4 +
src/include/access/slru.h              |  14 +--
src/include/storage/sync.h             |   7 +-
src/tools/pgindent/typedefs.list       |   5 +-
16 files changed, 252 insertions(+), 172 deletions(-)



Message-ID: <E1kLhn6-0006gM-6i@gemulon.postgresql.org>
Permalink:  ../E1kLhn6-0006gM-6i@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1kLhn6-0006gM-6i@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: Defer flushing of SLRU files.
  In-Reply-To: <E1kLhn6-0006gM-6i@gemulon.postgresql.org>
  References: <E1kLhn6-0006gM-6i@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