Re: Use of sync() [was Re: Potential Large Performance Gain in WAL synching] - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Use of sync() [was Re: Potential Large Performance Gain in WAL synching]
Date
Msg-id 4290.1033836914@sss.pgh.pa.us
Whole thread Raw
In response to Re: Use of sync() [was Re: Potential Large Performance Gain in WAL synching]  (Doug McNaught <doug@wireboard.com>)
List pgsql-hackers
Doug McNaught <doug@wireboard.com> writes:
> Tom Lane <tgl@sss.pgh.pa.us> writes:
>> 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 ...

> In my understanding, it means "all currently dirty blocks in the file
> cache are queued to the disk driver".  The queued writes will
> eventually complete, but not necessarily before sync() returns.  I
> don't think subsequent write()s will block, unless the system is low
> on buffers and has to wait until dirty blocks are freed by the driver.

We don't need later write()s to block.  We only need them to not hit
disk before the sync-queued writes hit disk.  So I guess the question
boils down to what "queued to the disk driver" means --- has the order
of writes been determined at that point?
        regards, tom lane


pgsql-hackers by date:

Previous
From: "Curtis Faith"
Date:
Subject: Re: Proposed LogWriter Scheme, WAS: Potential Large Performance Gain in WAL synching
Next
From: "Curtis Faith"
Date:
Subject: Re: Proposed LogWriter Scheme, WAS: Potential Large Performance