Re: sync()

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Tatsuo Ishii <t-ishii@sra.co.jp>
Cc: pgman@candle.pha.pa.us, pgsql-hackers@postgresql.org
Date: 2003-01-08T06:46:57Z
Lists: pgsql-hackers
Tatsuo Ishii <t-ishii@sra.co.jp> writes:
>> What we really need is something better than sync(), viz flush all dirty
>> buffers to disk *and* wait till they're written.  But sync() and sleep
>> for awhile is the closest portable approximation.

> Are you saying that fsync() might not wait untill the IO completes?

No, I said that sync() might not.  Read the man pages.  HPUX's man
page for sync(2) says

     sync() causes all information in memory that should be on disk to be
     written out.
     ...
     The writing, although scheduled, is not necessarily complete upon
     return from sync.

			regards, tom lane