This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author icharnas
Recipients icharnas
Date 2008-08-07.04:07:36
SpamBayes Score 3.3821238e-05
Marked as misclassified No
Message-id <1218082061.12.0.0384174375737.issue3512@psf.upfronthosting.co.za>
In-reply-to
Content
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
History
Date User Action Args
2008-08-07 04:07:41icharnassetrecipients: + icharnas
2008-08-07 04:07:41icharnassetmessageid: <1218082061.12.0.0384174375737.issue3512@psf.upfronthosting.co.za>
2008-08-07 04:07:39icharnaslinkissue3512 messages
2008-08-07 04:07:37icharnascreate