Re: initdb and fsync

Поиск
Список
Период
Сортировка
От Jeff Davis
Тема Re: initdb and fsync
Дата
Msg-id 1328398887.15224.17.camel@jdavis
обсуждение исходный текст
Ответ на Re: initdb and fsync  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: initdb and fsync  (Noah Misch <noah@leadboat.com>)
Список pgsql-hackers
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

Вложения

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Florian Weimer
Дата:
Сообщение: Re: initdb and fsync
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Patch: Allow SQL-language functions to reference parameters by parameter name