Re: Use of sync() [was Re: Potential Large Performance Gain in WAL synching]

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Mats Lofkvist <mal(at)algonet(dot)se>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Use of sync() [was Re: Potential Large Performance Gain in WAL synching]
Date: 2002-10-05 16:07:37
Message-ID: 3943.1033834057@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Mats Lofkvist <mal(at)algonet(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Doug McNaught 2002-10-05 16:29:33 Re: Use of sync() [was Re: Potential Large Performance Gain in WAL synching]
Previous Message Tom Lane 2002-10-05 15:36:35 Re: [SQL] [GENERAL] CURRENT_TIMESTAMP