]> granicus.if.org Git - postgresql/commit
Refactor the fsync queue for wider use.
authorThomas Munro <tmunro@postgresql.org>
Thu, 4 Apr 2019 08:56:03 +0000 (21:56 +1300)
committerThomas Munro <tmunro@postgresql.org>
Thu, 4 Apr 2019 10:38:38 +0000 (23:38 +1300)
commit3eb77eba5a51780d5cf52cd66a9844cd4d26feb0
tree8602d49072771b9c6c21c642110844b5f5c87939
parent33215d113d61980a4b2f2aec36cdcd21fa58c1c4
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
18 files changed:
src/backend/access/transam/twophase.c
src/backend/access/transam/xact.c
src/backend/access/transam/xlog.c
src/backend/commands/dbcommands.c
src/backend/postmaster/checkpointer.c
src/backend/storage/Makefile
src/backend/storage/buffer/bufmgr.c
src/backend/storage/smgr/md.c
src/backend/storage/smgr/smgr.c
src/backend/storage/sync/Makefile [new file with mode: 0644]
src/backend/storage/sync/sync.c [new file with mode: 0644]
src/backend/utils/init/postinit.c
src/include/postmaster/bgwriter.h
src/include/storage/fd.h
src/include/storage/md.h [new file with mode: 0644]
src/include/storage/smgr.h
src/include/storage/sync.h [new file with mode: 0644]
src/tools/pgindent/typedefs.list