]> granicus.if.org Git - postgresql/commit
Rethink checkpointer's fsync-request table representation.
authorTom Lane <tgl@sss.pgh.pa.us>
Thu, 19 Jul 2012 23:28:27 +0000 (19:28 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Thu, 19 Jul 2012 23:28:27 +0000 (19:28 -0400)
commite3981da37a2f071951e54d74d45ad47733cc74a6
treee02c043148a0a842b2f81c28281dc273f276d358
parent2bc30516c728fddf791ec508056a9c92c65025af
Rethink checkpointer's fsync-request table representation.

Instead of having one hash table entry per relation/fork/segment, just have
one per relation, and use bitmapsets to represent which specific segments
need to be fsync'd.  This eliminates the need to scan the whole hash table
to implement FORGET_RELATION_FSYNC, which fixes the O(N^2) behavior
recently demonstrated by Jeff Janes for cases involving lots of TRUNCATE or
DROP TABLE operations during a single checkpoint cycle.  Per an idea from
Robert Haas.

(FORGET_DATABASE_FSYNC still sucks, but since dropping a database is a
pretty expensive operation anyway, we'll live with that.)

In passing, improve the delayed-unlink code: remove the pass over the list
in mdpreckpt, since it wasn't doing anything for us except supporting a
useless Assert in mdpostckpt, and fix mdpostckpt so that it will absorb
fsync requests every so often when clearing a large backlog of deletion
requests.
src/backend/storage/smgr/md.c