Skip to content

armgit / solr

Public Imported from GitHub
0

Apache Solr open-source search software

Merging with trunk.

Dawid Weissc72e8820a1b6
diff --cc lucene/CHANGES.txt
index 64b6c0dd229,8fa367f320c..0d029df8006
--- a/lucene/CHANGES.txt
+++ b/lucene/CHANGES.txt
@@@ -231,11 -236,18 +236,21 @@@ Bug fixe
* LUCENE-5568: Benchmark module's "default.codec" option didn't work. (David Smiley)
+ * LUCENE-5574: Closing a near-real-time reader no longer attempts to
+ delete unreferenced files if the original writer has been closed;
+ this could cause index corruption in certain cases where index files
+ were directly changed (deleted, overwritten, etc.) in the index
+ directory outside of Lucene. (Simon Willnauer, Shai Erera, Robert
+ Muir, Mike McCandless)
+
+ * LUCENE-5570: Don't let FSDirectory.sync() create new zero-byte files, instead throw
+ exception if a file is missing. (Uwe Schindler, Mike McCandless, Robert Muir)
+
Test Framework
+* LUCENE-5577: Temporary folder and file management (and cleanup facilities)
+ (Mark Miller, Uwe Schindler, Dawid Weiss)
+
* LUCENE-5567: When a suite fails with zombie threads failure marker and count
is not propagated properly. (Dawid Weiss)
diff --cc lucene/core/src/test/org/apache/lucene/store/TestDirectory.java
index e500a0dee1c,7e0b4d308c2..e26b66f3fa7
--- a/lucene/core/src/test/org/apache/lucene/store/TestDirectory.java
+++ b/lucene/core/src/test/org/apache/lucene/store/TestDirectory.java
@@@ -285,8 -285,37 +286,37 @@@ public class TestDirectory extends Luce
}
} finally {
fsDir.close();
- TestUtil.rmDir(path);
+ TestUtil.rm(path);
}
}
+
+ public void testFsyncDoesntCreateNewFiles() throws Exception {
+ File path = TestUtil.getTempDir("nocreate");
+ Directory fsdir = new SimpleFSDirectory(path);
+
+ // write a file
+ IndexOutput out = fsdir.createOutput("afile", newIOContext(random()));
+ out.writeString("boo");
+ out.close();
+
+ // delete it
+ assertTrue(new File(path, "afile").delete());
+
+ // directory is empty
+ assertEquals(0, fsdir.listAll().length);
+
+ // fsync it
+ try {
+ fsdir.sync(Collections.singleton("afile"));
+ fail("didn't get expected exception, instead fsync created new files: " + Arrays.asList(fsdir.listAll()));
+ } catch (FileNotFoundException | NoSuchFileException expected) {
+ // ok
+ }
+
+ // directory is still empty
+ assertEquals(0, fsdir.listAll().length);
+
+ fsdir.close();
+ }
}