pgsql: Defer flushing of SLRU files.

From: Thomas Munro <tmunro(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Defer flushing of SLRU files.
Date: 2020-09-25 07:05:12
Message-ID: E1kLhn6-0006gM-6i@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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(at)sss(dot)pgh(dot)pa(dot)us> (parts)
Tested-by: Jakub Wartak <Jakub(dot)Wartak(at)tomtom(dot)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(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Amit Kapila 2020-09-26 04:53:57 pgsql: Fix the logical replication from HEAD to lower versions.
Previous Message Michael Paquier 2020-09-25 01:27:03 pgsql: Remove custom memory allocation layer in pgcrypto