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.

classification
Title: PATCH - Providing fullfsync on supported platforms
Type: behavior Stage:
Components: Library (Lib) Versions: Python 2.6
process
Status: closed Resolution: accepted
Dependencies: Superseder:
Assigned To: Nosy List: gvanrossum, icharnas
Priority: normal Keywords: patch

Created on 2008-08-07 17:31 by icharnas, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
fullfsync.patch icharnas, 2008-08-07 17:31
fullfsync_fcntl.patch icharnas, 2008-08-07 18:42
Messages (4)
msg70842 - (view) Author: Ian Charnas (icharnas) Date: 2008-08-07 17:31
Python currently provides os.fsync to call the POSIX 'fsync' on
platforms that support it.  While this function forces the operating
system to force a file buffer to the storage device, data may still be
waiting in the hardware write buffers on the storage device.  Certain
platforms (so far, only OS X) provide "fullfsync" [1] to request that
storage devices flush their write buffers to the actual physical media.  

This functionality is especially useful to VCS and DB developers, and
already appears in SQLite [2] and MySQL [3], amongst others.

This patch includes code changes to Modules/posixmodule.c that exposes
os.fullfsync on supported platforms, including the appropriate
documentation added to Doc/library/os.rst

-Ian Charnas

[1] Discussion of fsync and fullfsync on darwin platform:
http://lists.apple.com/archives/darwin-dev/2005/Feb/msg00072.html

[2] SQLite uses fullfsync on all platforms that define it:
http://www.sqlite.org/cvstrac/fileview?f=sqlite/src/os_unix.c

[3] 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
msg70847 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2008-08-07 18:16
I'm sorry to have lead you this way, but since there is no fullfsync()
system call, IMO you should just make the F_FULLFSYNC constant
available.  That should go into fcntlmodule.c.
msg70849 - (view) Author: Ian Charnas (icharnas) Date: 2008-08-07 18:42
Sounds fair enough.  I was looking forward to the glitz and glamor of
the os module, but I'll settle for a good seat in fcntl.  Here's a patch
implementing just that.

-ian
msg70851 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2008-08-07 18:52
Thanks, checked into the trunk as r65581.
History
Date User Action Args
2022-04-11 14:56:37adminsetgithub: 47767
2008-08-07 18:52:10gvanrossumsetstatus: open -> closed
resolution: accepted
messages: + msg70851
2008-08-07 18:42:28icharnassetfiles: + fullfsync_fcntl.patch
messages: + msg70849
2008-08-07 18:16:17gvanrossumsetnosy: + gvanrossum
messages: + msg70847
2008-08-07 17:31:59icharnascreate