You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by mi...@apache.org on 2015/08/30 11:35:43 UTC
svn commit: r1700100 - in /lucene/dev/trunk/lucene:
core/src/java/org/apache/lucene/index/IndexFileDeleter.java
test-framework/src/java/org/apache/lucene/store/BaseLockFactoryTestCase.java
Author: mikemccand
Date: Sun Aug 30 09:35:43 2015
New Revision: 1700100
URL: http://svn.apache.org/r1700100
Log:
LUCENE-6684: disable asserts on windows that false-trip due to 'pending delete' state that an NTFS file can be in
Modified:
lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/index/IndexFileDeleter.java
lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/store/BaseLockFactoryTestCase.java
Modified: lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/index/IndexFileDeleter.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/index/IndexFileDeleter.java?rev=1700100&r1=1700099&r2=1700100&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/index/IndexFileDeleter.java (original)
+++ lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/index/IndexFileDeleter.java Sun Aug 30 09:35:43 2015
@@ -20,6 +20,7 @@ package org.apache.lucene.index;
import org.apache.lucene.store.AlreadyClosedException;
import org.apache.lucene.store.Directory;
import org.apache.lucene.util.CollectionUtil;
+import org.apache.lucene.util.Constants;
import org.apache.lucene.util.IOUtils;
import org.apache.lucene.util.InfoStream;
@@ -747,8 +748,9 @@ final class IndexFileDeleter implements
} catch (IOException e) { // if delete fails
// IndexWriter should only ask us to delete files it knows it wrote, so if we hit this, something is wrong!
- assert e instanceof NoSuchFileException == false: "hit unexpected NoSuchFileException: file=" + fileName;
- assert e instanceof FileNotFoundException == false: "hit unexpected FileNotFoundException: file=" + fileName;
+ // LUCENE-6684: we suppress this assert for Windows, since a file could be in a confusing "pending delete" state:
+ assert Constants.WINDOWS || e instanceof NoSuchFileException == false: "hit unexpected NoSuchFileException: file=" + fileName;
+ assert Constants.WINDOWS || e instanceof FileNotFoundException == false: "hit unexpected FileNotFoundException: file=" + fileName;
// Some operating systems (e.g. Windows) don't
// permit a file to be deleted while it is opened
Modified: lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/store/BaseLockFactoryTestCase.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/store/BaseLockFactoryTestCase.java?rev=1700100&r1=1700099&r2=1700100&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/store/BaseLockFactoryTestCase.java (original)
+++ lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/store/BaseLockFactoryTestCase.java Sun Aug 30 09:35:43 2015
@@ -17,16 +17,6 @@ package org.apache.lucene.store;
* limitations under the License.
*/
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.PrintStream;
-import java.io.UnsupportedEncodingException;
-import java.nio.file.Path;
-import java.util.concurrent.CyclicBarrier;
-import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.concurrent.atomic.AtomicInteger;
-import java.util.concurrent.locks.ReentrantLock;
-
import org.apache.lucene.analysis.MockAnalyzer;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
@@ -39,9 +29,21 @@ import org.apache.lucene.index.Term;
import org.apache.lucene.search.IndexSearcher;
import org.apache.lucene.search.Query;
import org.apache.lucene.search.TermQuery;
+import org.apache.lucene.util.Constants;
import org.apache.lucene.util.LuceneTestCase;
import org.apache.lucene.util.PrintStreamInfoStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.PrintStream;
+import java.io.UnsupportedEncodingException;
+import java.nio.file.AccessDeniedException;
+import java.nio.file.Path;
+import java.util.concurrent.CyclicBarrier;
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.concurrent.locks.ReentrantLock;
+
/** Base class for per-LockFactory tests. */
public abstract class BaseLockFactoryTestCase extends LuceneTestCase {
@@ -229,10 +231,17 @@ public abstract class BaseLockFactoryTes
// IndexWriters should be "fair" (ie
// FIFO).
} catch (Throwable t) {
- hitException = true;
- System.out.println("Stress Test Index Writer: creation hit unexpected exception: " + t.toString());
- t.printStackTrace(System.out);
- System.out.println(toString(baos));
+ if (Constants.WINDOWS && t instanceof AccessDeniedException) {
+ // LUCENE-6684: suppress this: on Windows, a file in the curious "pending delete" state can
+ // cause this exc on IW init, where one thread/process deleted an old
+ // segments_N, but the delete hasn't finished yet because other threads/processes
+ // still have it open
+ } else {
+ hitException = true;
+ System.out.println("Stress Test Index Writer: creation hit unexpected exception: " + t.toString());
+ t.printStackTrace(System.out);
+ System.out.println(toString(baos));
+ }
break;
}
if (writer != null) {