pgsql: Refactor the fsync queue for wider use. - Mailing list pgsql-committers

From Thomas Munro
Subject pgsql: Refactor the fsync queue for wider use.
Date
Msg-id E1hBzrq-0006Rd-ED@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
Refactor the fsync queue for wider use.

Previously, md.c and checkpointer.c were tightly integrated so that
fsync calls could be handed off and processed in the background.
Introduce a system of callbacks and file tags, so that other modules
can hand off fsync work in the same way.

For now only md.c uses the new interface, but other users are being
proposed.  Since there may be use cases that are not strictly SMGR
implementations, use a new function table for sync handlers rather
than extending the traditional SMGR one.

Instead of using a bitmapset of segment numbers for each RelFileNode
in the checkpointer's hash table, make the segment number part of the
key.  This requires sending explicit "forget" requests for every
segment individually when relations are dropped, but suits the file
layout schemes of proposed future users better (ie sparse or high
segment numbers).

Author: Shawn Debnath and Thomas Munro
Reviewed-by: Thomas Munro, Andres Freund
Discussion: https://postgr.es/m/CAEepm=2gTANm=e3ARnJT=n0h8hf88wqmaZxk0JYkxw+b21fNrw@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/3eb77eba5a51780d5cf52cd66a9844cd4d26feb0

Modified Files
--------------
src/backend/access/transam/twophase.c |   1 +
src/backend/access/transam/xact.c     |   1 +
src/backend/access/transam/xlog.c     |   7 +-
src/backend/commands/dbcommands.c     |   7 +-
src/backend/postmaster/checkpointer.c |  40 +-
src/backend/storage/Makefile          |   2 +-
src/backend/storage/buffer/bufmgr.c   |   2 +-
src/backend/storage/smgr/md.c         | 885 +++++-----------------------------
src/backend/storage/smgr/smgr.c       |  55 +--
src/backend/storage/sync/Makefile     |  17 +
src/backend/storage/sync/sync.c       | 598 +++++++++++++++++++++++
src/backend/utils/init/postinit.c     |   2 +
src/include/postmaster/bgwriter.h     |   8 +-
src/include/storage/fd.h              |  12 +
src/include/storage/md.h              |  51 ++
src/include/storage/smgr.h            |  38 --
src/include/storage/sync.h            |  62 +++
src/tools/pgindent/typedefs.list      |   6 +-
18 files changed, 904 insertions(+), 890 deletions(-)


pgsql-committers by date:

Previous
From: Peter Eisentraut
Date:
Subject: pgsql: file_fdw: Fix for generated columns
Next
From: Stephen Frost
Date:
Subject: pgsql: Move the be_gssapi_get_* prototypes