Re: Use of sync() [was Re: Potential Large Performance Gain in WAL synching]
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Mats Lofkvist <mal@algonet.se>
Cc: pgsql-hackers@postgresql.org
Date: 2002-10-05T16:07:37Z
Lists: pgsql-hackers
Mats Lofkvist <mal@algonet.se> writes:
> [ mdsync is ugly and not completely reliable ]
Yup, it is. Do you have a better solution?
fsync is not the answer, since the checkpoint process has no way to know
what files may have been touched since the last checkpoint ... and even
if it could find that out, a string of retail fsync calls would kill
performance, cf. Curtis Faith's complaint.
In practice I am not sure there is a problem. The local man page for
sync() says
The writing, although scheduled, is not necessarily complete upon
return from sync.
Now if "scheduled" means "will occur before any subsequently-commanded
write occurs" then we're fine. I don't know if that's true though ...
regards, tom lane