Defer flushing of SLRU files.
Thomas Munro <tmunro@postgresql.org>
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
Files
| Path | Change | +/− |
|---|---|---|
| src/backend/access/transam/clog.c | modified | +18 −22 |
| src/backend/access/transam/commit_ts.c | modified | +17 −19 |
| src/backend/access/transam/multixact.c | modified | +32 −25 |
| src/backend/access/transam/slru.c | modified | +106 −48 |
| src/backend/access/transam/subtrans.c | modified | +3 −22 |
| src/backend/access/transam/xlog.c | modified | +18 −10 |
| src/backend/commands/async.c | modified | +2 −3 |
| src/backend/storage/buffer/bufmgr.c | modified | +0 −7 |
| src/backend/storage/lmgr/predicate.c | modified | +3 −5 |
| src/backend/storage/sync/sync.c | modified | +25 −3 |
| src/include/access/clog.h | modified | +3 −0 |
| src/include/access/commit_ts.h | modified | +3 −0 |
| src/include/access/multixact.h | modified | +4 −0 |
| src/include/access/slru.h | modified | +9 −5 |
| src/include/storage/sync.h | modified | +6 −1 |
| src/tools/pgindent/typedefs.list | modified | +3 −2 |
Discussion
- Handing off SLRU fsyncs to the checkpointer 31 messages · 2020-02-12 → 2021-01-04