On Mon, Jun 01, 2009 at 03:09:46AM +0100, Simon Slavin wrote: > On 31 May 2009, at 11:56pm, John Stanton wrote: > > You will then understand the reason for absolute transactional > > integrity and why Sqlite must use fsync or similar and expects fsync > > to be a complete implementation which ensures that each transaction > > is permanently stored once a COMMIT has succeeded. > > You won't be using Unix, then. I'm about to horrify you: 'man fsync' > > "Note that while fsync() will flush all data from the host to the > drive (i.e. the "permanent storage device"), the drive itself may not > physically write the data to the platters for quite some time and it > may be written in an out-of-order sequence. > Specifically, if the drive loses power or the OS crashes, the > application may find that only some or none of their data was written. > The disk drive may also re-order the data so that later writes may be > present, while earlier writes are not."
The Unix operating system I use says something rather different: The fsync() function moves all modified data and attributes of the file descriptor fildes to a storage device. When fsync() returns, all in-memory modified copies of buffers associated with fildes have been written to the physical medium. The fsync() function is different from sync(), which schedules disk I/O for all files but returns before the I/O completes. The fsync() function forces all outstanding data operations to synchronized file integrity completion (see fcntl.h(3HEAD) definition of O_SYNC.) The fsync() function forces all currently queued I/O opera- tions associated with the file indicated by the file descriptor fildes to the synchronized I/O completion state. All I/O operations are completed as defined for synchronized I/O file integrity completion. > Absolutely. With an OS designed for ACID, and all storage stuff I've never heard of an operating system designed for ACID. I've heard of operating systems that are good for enterprise use though. (It's hard to speak of operating systems as being designed for anything in particular when most operating systems are fairly old and general purpose; special purpose OSes, OTOH, are special purpose OSes.) _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users