You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by rm...@apache.org on 2012/10/03 01:36:22 UTC
svn commit: r1393237 -
/lucene/dev/branches/lucene4456/lucene/test-framework/src/java/org/apache/lucene/store/MockDirectoryWrapper.java
Author: rmuir
Date: Tue Oct 2 23:36:22 2012
New Revision: 1393237
URL: http://svn.apache.org/viewvc?rev=1393237&view=rev
Log:
blind stab at waaaat 2.0 (I cannot reproduce it)
Modified:
lucene/dev/branches/lucene4456/lucene/test-framework/src/java/org/apache/lucene/store/MockDirectoryWrapper.java
Modified: lucene/dev/branches/lucene4456/lucene/test-framework/src/java/org/apache/lucene/store/MockDirectoryWrapper.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4456/lucene/test-framework/src/java/org/apache/lucene/store/MockDirectoryWrapper.java?rev=1393237&r1=1393236&r2=1393237&view=diff
==============================================================================
--- lucene/dev/branches/lucene4456/lucene/test-framework/src/java/org/apache/lucene/store/MockDirectoryWrapper.java (original)
+++ lucene/dev/branches/lucene4456/lucene/test-framework/src/java/org/apache/lucene/store/MockDirectoryWrapper.java Tue Oct 2 23:36:22 2012
@@ -39,6 +39,7 @@ import org.apache.lucene.index.Directory
import org.apache.lucene.index.IndexWriter;
import org.apache.lucene.index.IndexWriterConfig;
import org.apache.lucene.index.NoDeletionPolicy;
+import org.apache.lucene.index.SegmentInfos;
import org.apache.lucene.util.LuceneTestCase;
import org.apache.lucene.util._TestUtil;
@@ -599,7 +600,37 @@ public class MockDirectoryWrapper extend
if (pendingDeletions.contains("segments.gen") && endSet.contains("segments.gen")) {
// this is possible if we hit an exception while writing segments.gen, we try to delete it
// and it ends out in pendingDeletions (but IFD wont remove this).
- endSet.remove("segments.gen");
+ startSet.add("segments.gen");
+ if (LuceneTestCase.VERBOSE) {
+ System.out.println("MDW: Unreferenced check: Ignoring segments.gen that we could not delete.");
+ }
+ }
+
+ // its possible we cannot delete the segments_N on windows if someone has it open and
+ // maybe other files too, depending on timing. normally someone on windows wouldnt have
+ // an issue (IFD would nuke this stuff eventually), but we pass NoDeletionPolicy...
+ for (String file : pendingDeletions) {
+ if (file.startsWith("segments") && !file.equals("segments.gen") && endSet.contains(file)) {
+ startSet.add(file);
+ if (LuceneTestCase.VERBOSE) {
+ System.out.println("MDW: Unreferenced check: Ignoring segments file: " + file + " that we could not delete.");
+ }
+ try {
+ SegmentInfos sis = new SegmentInfos();
+ sis.read(delegate, file);
+ Set<String> ghosts = new HashSet<String>(sis.files(delegate, false));
+ for (String s : ghosts) {
+ if (endSet.contains(s) && !startSet.contains(s)) {
+ assert pendingDeletions.contains(s);
+ if (LuceneTestCase.VERBOSE) {
+ System.out.println("MDW: Unreferenced check: Ignoring referenced file: " + s + " " +
+ "from " + file + " that we could not delete.");
+ }
+ startSet.add(s);
+ }
+ }
+ } catch (Throwable ignore) {}
+ }
}
startFiles = startSet.toArray(new String[0]);