Skip site navigation (1) Skip section navigation (2)

Re: postgresql.conf archive_command example

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: Florian Pflug <fgp(at)phlo(dot)org>
Cc: Aidan Van Dyk <aidan(at)highrise(dot)ca>, Fujii Masao <masao(dot)fujii(at)gmail(dot)com>,Robert Treat <rob(at)xzilla(dot)net>,Kevin Grittner <Kevin(dot)Grittner(at)wicourts(dot)gov>,Dimitri Fontaine <dimitri(at)2ndquadrant(dot)fr>,Josh Berkus <josh(at)agliodbs(dot)com>,Robert Haas <robertmhaas(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org,Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: postgresql.conf archive_command example
Date: 2011-09-09 19:11:41
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackers
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
you're nuts).

> 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>
> 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 FarinaDate: 2011-09-09 20:38:47
Subject: Re: memory-related bugs
Previous:From: Florian PflugDate: 2011-09-09 18:59:43
Subject: Re: postgresql.conf archive_command example

Privacy Policy | About PostgreSQL
Copyright © 1996-2018 The PostgreSQL Global Development Group