Re: [COMMITTERS] Re: pgsql: Speed up CREATE DATABASE by deferring the fsyncs until after

Поиск
Список
Период
Сортировка
От Greg Stark
Тема Re: [COMMITTERS] Re: pgsql: Speed up CREATE DATABASE by deferring the fsyncs until after
Дата
Msg-id 407d949e1002230112o569eea1w97fd1aacc5a8bcec@mail.gmail.com
обсуждение исходный текст
Ответ на Re: [COMMITTERS] Re: pgsql: Speed up CREATE DATABASE by deferring the fsyncs until after  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: [COMMITTERS] Re: pgsql: Speed up CREATE DATABASE by deferring the fsyncs until after  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
On Tue, Feb 23, 2010 at 5:37 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> So the problem is that fsync_fname is trying to fsync a file it's opened
> O_RDONLY.  I don't know whether Windows is similarly picky, but we'll
> soon find out.
>

Argh, now I feel silly. I had actually found that in my searches after
the first batch of problems. But somehow i didn't connect that to the
current problems. Sorry.

There are other similarly confused OSes that don't allow fsync on
read-only file descriptors:
http://svn.haxx.se/dev/archive-2006-02/0488.shtml
(I wonder if some of them are doing fsync wrong and only syncing
changes written to this file descriptor and not any file descriptor
for this file?)

The plan I was thinking of was to pass a flag indicating if it's a
directory to fsync_fname() and open it RD_ONLY if it's a directory and
RDRW if it's a file. Then ignore any error returns (or at least EBADF
and EINVAL) iff the flag indicating it was a directory was true.

I don't like using configure tests for this because I fear someone
could compile Postgres on a system with one set of behaviour and then
switch to a different kernel version with a different set of
behaviour. In the worst case it could be filesystem dependent whether
you can open directories or whether they accept fsyncs.

--
greg


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

Предыдущее
От: Stefan Kaltenbrunner
Дата:
Сообщение: SR/libpq - outbound interface/ipaddress binding
Следующее
От: Magnus Hagander
Дата:
Сообщение: Re: synchronous commit in dump