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: Refactor the fsync queue for wider use.
Date: Thu, 04 Apr 2019 10:45:10 +0000
Message-ID: <E1hBzrq-0006Rd-ED@gemulon.postgresql.org> (raw)

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(-)



Message-ID: <E1hBzrq-0006Rd-ED@gemulon.postgresql.org>
Permalink:  ../E1hBzrq-0006Rd-ED@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1hBzrq-0006Rd-ED@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: Refactor the fsync queue for wider use.
  In-Reply-To: <E1hBzrq-0006Rd-ED@gemulon.postgresql.org>
  References: <E1hBzrq-0006Rd-ED@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