You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by us...@apache.org on 2014/04/10 23:55:10 UTC
svn commit: r1586476 - in /lucene/dev/branches/branch_4x: ./ lucene/
lucene/core/ lucene/core/src/java/org/apache/lucene/store/FSDirectory.java
Author: uschindler
Date: Thu Apr 10 21:55:10 2014
New Revision: 1586476
URL: http://svn.apache.org/r1586476
Log:
Merged revision(s) 1586475 from lucene/dev/trunk:
LUCENE-5588: Workaround for fsyncing non-existing directory
Modified:
lucene/dev/branches/branch_4x/ (props changed)
lucene/dev/branches/branch_4x/lucene/ (props changed)
lucene/dev/branches/branch_4x/lucene/core/ (props changed)
lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/store/FSDirectory.java
Modified: lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/store/FSDirectory.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/store/FSDirectory.java?rev=1586476&r1=1586475&r2=1586476&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/store/FSDirectory.java (original)
+++ lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/store/FSDirectory.java Thu Apr 10 21:55:10 2014
@@ -302,10 +302,15 @@ public abstract class FSDirectory extend
Set<String> toSync = new HashSet<>(names);
toSync.retainAll(staleFiles);
- for (String name : toSync)
+ for (String name : toSync) {
fsync(name);
+ }
- IOUtils.fsync(directory, true);
+ // fsync the directory itsself, but only if there was any file fsynced before
+ // (otherwise it can happen that the directory does not yet exist)!
+ if (!toSync.isEmpty()) {
+ IOUtils.fsync(directory, true);
+ }
staleFiles.removeAll(toSync);
}