On May 22, 2008, at 9:40 AM, Shawn Wilsher wrote:

> It was mentioned in the bug that opening the file with the O_SYNC flag
> would no longer require fsyncs.  Has this been looked into before by
> sqlite?
>

I don't think this would work well.

The O_SYNC flag causes each write() system call to block until the  
data is on oxide.  But sometimes SQLite will do a sequence of small  
consecutive writes of a few bytes each with the anticipation that the  
filesystem will buffer these writes and only do a single write to  
oxide at the end.  So if we just blindly turned on O_SYNC, the number  
of disk writes would increase dramatically.

We could update the unix backend so that some amount of buffering was  
done in the backend itself to coalesce a sequence of small writes into  
a single write() system call.  This would reduce the amount of I/O  
back to what it was without the O_SYNC.  But it still does not reduce  
the amount of I/O and it also deprives the filesystem the opportunity  
to reorder write requests, which will likely result in an efficiency  
loss, not a gain.

Nevertheless, these kinds of things often defy logic, so I will give  
it a try and see what happens....

D. Richard Hipp
[EMAIL PROTECTED]



_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to