On Fri, Sep 09, 2011 at 08:59:43PM +0200, Florian Pflug wrote:
> Archiving WAL should be done by copying to a temp file and moving it
> into place. Before returning success, one should probably also do the
> fsync incantations the linux kernel guys argued are necessary to prevent
> the file from appearing empty if the machine crashes shortly after the
> move. (Yeah, they fixed that after enough people complained, but the fact
> that they even went as far as arguing their behaviour is correct according
> to POSIX makes me uneasy...)
Well, they fixed it for ext2/3/4 but that doesn't change the fact that
most other filesystems don't provide the same guarentees. If you want
to be sure the file contents hit the disk, you need to do an fsync.
(If you suggested to people we could add a new WAL sync method that
wrote the data to disk without fsync and renamed it over an existing
file and assured them that the data would survive a crash, they'd say
> It'd be very cool if we shipped a tool that did that correctly (pg_walcopy
> maybe?) on all supported platforms.
It's hard enough to get right that shipping a tool that works properly
is eminently sensible. If only to demonstrate how it should be done.
Have a nice day,
Martijn van Oosterhout <kleptog(at)svana(dot)org> http://svana.org/kleptog/
> He who writes carelessly confesses thereby at the very outset that he does
> not attach much importance to his own thoughts.
-- Arthur Schopenhauer
In response to
pgsql-hackers by date
|Next:||From: Daniel Farina||Date: 2011-09-09 20:38:47|
|Subject: Re: memory-related bugs|
|Previous:||From: Florian Pflug||Date: 2011-09-09 18:59:43|
|Subject: Re: postgresql.conf archive_command example|