Re: fsync or fdatasync

Поиск
Список
Период
Сортировка
От Mats Lofkvist
Тема Re: fsync or fdatasync
Дата
Msg-id y2q7khr626d.fsf@algonet.se
обсуждение исходный текст
Ответ на Re: fsync or fdatasync  (Bruce Momjian <pgman@candle.pha.pa.us>)
Ответы Re: fsync or fdatasync  (Bruce Momjian <pgman@candle.pha.pa.us>)
Список pgsql-admin
pgman@candle.pha.pa.us (Bruce Momjian) writes:

> Ragnar Kjørstad wrote:
> > On Tue, Sep 10, 2002 at 11:40:24AM -0400, Bruce Momjian wrote:
> > >
> > > The original poster was wrong about the default.
> > >
> > > We use fdatasync where available, and fsync when it is not.
> >
> > Makes sense.
> >
> > > We also use
> > > O_SYNC on open if it is available.
> >
> > Why? That will slow tings down...
>
> Actually, no, we are only O_SYNC'ing the WAL writes and sometimes that
> is faster because you are not writing then fsyncing, you are just
> writing.  The fdatasync only is better than O_SYNC when you are doing
> multiple WAL writes before an fdatasync and we normally don't do that.
>

I may be wrong on this, but my understanding is that the difference
between fsync() and O_SYNC on the one hand and fdatasync() and O_DSYNC
on the other hand is that the latter don't have to sync metadata
(e.g. file access times) which saves a write to the inode that is
more or less guarantied to require an extra seek.

Iff this is true you never want to use fsync() or O_SYNC when
fdatasync() and O_DSYNC is available (unless you really need the
metadata to be synced too).

      _
Mats Lofkvist
mal@algonet.se

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

Предыдущее
От: Krammer Clemens
Дата:
Сообщение: disk spin down
Следующее
От: "shreedhar"
Дата:
Сообщение: Is it possible 'Rollback' and 'Commit' Transactions in postgre functions