On Thu, 27 Nov 2003, Doug McNaught wrote:
> Tom Lane <tgl@sss.pgh.pa.us> writes:
>
> > Doug McNaught <doug@mcnaught.org> writes:
> >> Alex Satrapa <alex@lintelsys.com.au> writes:
> >>> 1) Under Linux, if you have the file system containing the WAL mounted
> >>> with asynchronous writes, "all bets are off".
> >> ...
> >> Even with ext2, WAL files are preallocated and PG calls fsync() after
> >> writing, so in practice it's not likely to cause problems.
> >
> > Um. I took the reference to "mounted with async write" to mean a
> > soft-mounted NFS filesystem. It does not matter which OS you think is
> > the one true OS --- running a database over NFS is the act of someone
> > with a death wish. But, yeah, soft-mounted NFS is a particularly
> > malevolent variety ...
>
> I took it as a garbled understanding of the "Linux does async metadata
> updates" criticism. Which is true for ext2, but was never the
> show-stopper some BSD-ers wanted it to be. :)
And it's not file metadata, it's directory data. Metadata (inode
data) is synced, even in ext2, AFAIK.
Quoting the man page:
fsync copies all in-core parts of a file to disk, and
waits until the device reports that all parts are on sta-
ble storage. It also updates metadata stat information.
It does not necessarily ensure that the entry in the
directory containing the file has also reached disk. For
that an explicit fsync on the file descriptor of the
directory is also needed
For WALs, this is perfectly fine. It can be a problem for those
applications that do a lot of renames and relay on those as
sync/locking mechanisms (think of mail spoolers).
.TM.
--
____/ ____/ /
/ / / Marco Colombo
___/ ___ / / Technical Manager
/ / / ESI s.r.l.
_____/ _____/ _/ Colombo@ESI.it