Recent Java 9 commit (e5b66323ae45) breaks fsync on directory

Uwe Schindler uschindler at apache.org
Wed May 13 09:27:09 UTC 2015


Hi Brian,

 

many thanks for opening this issue! I agree with Alan that adding an OpenOption would be a good possibility. In any case, as Files only contains static methods, we could still add a “utility” method that forces file/directory buffers to disk, that just uses the new open option under the hood. By that FileSystem SPI interfaces do not need to be modified and just need to take care about the new OpenOption (if supported).

 

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.

 

This different behavior breaks the guarantees of FileChannel#force on MacOSX (as described in Javadocs). So the MacOSX FileSystemProvider implementation should use this special fnctl to force file buffers to disk.

 

Should I open a bug report on bugs.sun.com?

 

Uwe

 

-----

Uwe Schindler

uschindler at apache.org 

ASF Member, Apache Lucene PMC / Committer

Bremen, Germany

http://lucene.apache.org/

 

From: nio-dev [mailto:nio-dev-bounces at openjdk.java.net] On Behalf Of Brian Burkhalter
Sent: Wednesday, May 13, 2015 12:26 AM
To: nio-dev
Cc: rory.odonnell at oracle.com; dev at lucene.apache.org; Balchandra Vaidya
Subject: Re: Recent Java 9 commit (e5b66323ae45) breaks fsync on directory

 

I have created an enhancement issue here:

 

https://bugs.openjdk.java.net/browse/JDK-8080235

 

Brian

 

On May 12, 2015, at 3:10 PM, Brian Burkhalter <brian.burkhalter at oracle.com> wrote:





I will create an issue now and post the ID.

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/nio-dev/attachments/20150513/000bfaa1/attachment.html>


More information about the nio-dev mailing list