Re: initdb and fsync

Поиск
Список
Период
Сортировка
От Jeff Davis
Тема Re: initdb and fsync
Дата
Msg-id 1339606397.23449.13.camel@jdavis
обсуждение исходный текст
Ответ на Re: initdb and fsync  (Peter Eisentraut <peter_e@gmx.net>)
Ответы Re: initdb and fsync  (Andres Freund <andres@2ndquadrant.com>)
Список pgsql-hackers
On Wed, 2012-06-13 at 13:53 +0300, Peter Eisentraut wrote:
> The --help output for the -N option was copy-and-pasted wrongly.
>
> The message issued when using -N is also a bit content-free.  Maybe
> something like
>
> "Running in nosync mode.  The data directory might become corrupt if the
> operating system crashes.\n"

Thank you, fixed.

> Which leads to the question, how does one get out of this state?  Is
> running sync(1) enough?  Is starting the postgres server enough?

sync(1) calls sync(2), and the man page says:

"According to the standard specification  (e.g.,  POSIX.1-2001),  sync()
schedules the writes, but may return before the actual writing is done.
However, since version 1.3.20 Linux does actually  wait.   (This  still
does not guarantee data integrity: modern disks have large caches.)"

So it looks like sync is enough if you are on linux *and* you have any
unprotected write cache disabled.

I don't think starting the postgres server is enough.

Before, I think we were safe because we could assume that the OS would
flush the buffers before you had time to store any important data. But
now, that window can be much larger.

> There are no updates to the initdb man page included in your patch,
> which would be a suitable place to discuss this briefly.

Thank you, I added that.

Regards,
    Jeff Davis

Вложения

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

Предыдущее
От: Robert Haas
Дата:
Сообщение: Re: [COMMITTERS] pgsql: Mark JSON error detail messages for translation.
Следующее
От: Tom Lane
Дата:
Сообщение: Re: [COMMITTERS] pgsql: Mark JSON error detail messages for translation.