Message70810
fsync on OSX does not actually flush the file to disk as is desired.
This is a problem because application developers rely on fsync for file
integrity. SQLite [1] and MySQL [2] and other major database systems
all use 'fullfsync' on OS X instead of fsync, because 'fullfsync'
provides the desired behavior.
Because the documented behavior of python's fsync function is to "force
write of file with filedescriptor to disk", I believe that on OS X the
fullfsync call should be used instead of fsync.
The supplied patch adds this functionality in a non-platform-specific
way. It checks if there is a FULLFSYNC fcntl call available (using
"#ifdef F_FULLFSYNC", where F_FULLFSYNC is defined in sys/fcntl.h), and
if this symbol is defined then a fnctl(F_FULLFSYNC, fd, 0) is called
instead of fsync.
[1] SQLite uses fullfsync on all platforms that define it:
http://www.sqlite.org/cvstrac/fileview?f=sqlite/src/os_unix.c
[2] MySQL uses fullfsync only on the darwin platform and only when
F_FULLFSYNC is defined as 51, which seems to be short-sighted in that
this symbol may change value in future versions of OS X. To see this
code, download a mysql 5.x source snapshot and open up
mysql-<version-number>/innobase/os/os0file.c |
|
Date |
User |
Action |
Args |
2008-08-07 04:07:41 | icharnas | set | recipients:
+ icharnas |
2008-08-07 04:07:41 | icharnas | set | messageid: <1218082061.12.0.0384174375737.issue3512@psf.upfronthosting.co.za> |
2008-08-07 04:07:39 | icharnas | link | issue3512 messages |
2008-08-07 04:07:37 | icharnas | create | |
|