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