Re: RE: xlog checkpoint depends on sync() ... seems uns afe - Mailing list pgsql-hackers

From Matthew Kirkwood
Subject Re: RE: xlog checkpoint depends on sync() ... seems uns afe
Date
Msg-id Pine.LNX.4.10.10103131046510.14830-100000@sphinx.mythic-beasts.com
Whole thread Raw
In response to Re: RE: xlog checkpoint depends on sync() ... seems uns afe  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On Tue, 13 Mar 2001, Tom Lane wrote:

> > I was told the same a long ago about FreeBSD. How much can we count on
> > this undocumented sync() feature?
> 
> Sounds quite unreliable to me.  Unless there's some interlock ...
> like, say, the second sync not being able to advance past a buffer
> page that's as yet unwritten by the first sync.  But would all Unixen
> share such a strange detail of implementation?

The Linux manpage says:

NAME      sync - commit buffer cache to disk.
[..]

DESCRIPTION      sync  first commits inodes to buffers, and then buffers to      disk.
[..]

CONFORMING TO      SVr4, SVID, X/OPEN, BSD 4.3

BUGS      According to  the  standard  specification  (e.g.,  SVID),      sync()  schedules  the  writes,  but may
returnbefore the      actual writing is done.   However,  since  version  1.3.20      Linux  does actually wait.  (This
stilldoes not guarantee      data integrity: modern disks have large caches.)
 


And it's still true.  On a fast system, if you do:

$ cp /dev/zero /tmp & sleep 1; sync

the sync will often never finish.  (Of course, that's
just an implementation detail really.)

Matthew.



pgsql-hackers by date:

Previous
From: Denis Perchine
Date:
Subject: Re: Performance monitor
Next
From: Zeugswetter Andreas SB
Date:
Subject: AW: RE: xlog loose ends, continued