On Sat, 2012-01-28 at 13:18 -0500, Tom Lane wrote: > Yeah. Personally I would be sad if initdb got noticeably slower, and > I've never seen or heard of a failure that this would fix.
I worked up a patch, and it looks like it does about 6 file fsync's and a 7th for the PGDATA directory. That degrades the time from about 1.1s to 1.4s on my workstation. pg_test_fsync says this about my workstation (one 8kB write): open_datasync 117.495 ops/sec fdatasync 117.949 ops/sec fsync 25.530 ops/sec fsync_writethrough n/a open_sync 24.666 ops/sec 25 ops/sec means about 40ms per fsync, times 7 is about 280ms, so that seems like about the right degradation for fsync. I tried with fdatasync as well to see if it improved things, and I wasn't able to realize any difference (not sure exactly why). So, is it worth it? Should we make it an option that can be specified? > I wonder whether it wouldn't be sufficient to call sync(2) at the end, > anyway, rather than cluttering the entire initdb codebase with fsync > calls. It looks like there are only a few places, so I don't think clutter is really the problem with the simple patch at this point (unless there is a portability problem with just calling fsync). Regards, Jeff Davis
initdb-fsync.patch.gz
Description: GNU Zip compressed data
-- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers