On 13/05/2015 10:27, Uwe Schindler wrote:
:
There is one additional issue we found recently on MacOSX, but this is
only slightly related to the one here. It looks like on MacOSX,
FileChannel#force is mostly a noop regarding syncing data to disk,
because the underlying operating system requires a “special” fnctl to
force buffers to disk device:
https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man2/fsync.2.html:
For applications that require tighter guarantees about the
integrity of their data, Mac OS X provides
the F_FULLFSYNC fcntl. The F_FULLFSYNC fcntl asks the drive to
flush all buffered data to permanent
storage. Applications, such as databases, that require a strict
ordering of writes should use F_FULLFSYNC
to ensure that their data is written in the order they expect.
Please see fcntl(2) for more
detail.
Thank for brining this up, I don't recall anyone pointing this out
before. I don't know if Apple's JDK use this fcntl but when the OS X
port came into OpenJDK then it implemented force as fsync (irrespective
of the metaData field).
Testing this is going to difficult through.
-Alan