mirror of https://github.com/apache/lucene.git
LUCENE-6684: disable asserts on windows that false-trip due to 'pending delete' state that an NTFS file can be in
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1700100 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
85b6c90b3a
commit
f7dc8767bb
|
@ -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 Closeable {
|
|||
} 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
|
||||
|
|
|
@ -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 BaseLockFactoryTestCase extends LuceneTestCase {
|
|||
// 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) {
|
||||
|
|
Loading…
Reference in New Issue