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 2015/04/01 02:55:00 UTC
svn commit: r1670529 - in /lucene/dev/trunk/lucene:
core/src/test/org/apache/lucene/search/
test-framework/src/java/org/apache/lucene/index/
test-framework/src/java/org/apache/lucene/util/
Author: rmuir
Date: Wed Apr 1 00:55:00 2015
New Revision: 1670529
URL: http://svn.apache.org/r1670529
Log:
merge unrelated nightly test bugfixes from LUCENE-6271 branch
Modified:
lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/search/TestLRUQueryCache.java
lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/index/ThreadedIndexingAndSearchingTestCase.java
lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/util/LineFileDocs.java
Modified: lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/search/TestLRUQueryCache.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/search/TestLRUQueryCache.java?rev=1670529&r1=1670528&r2=1670529&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/search/TestLRUQueryCache.java (original)
+++ lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/search/TestLRUQueryCache.java Wed Apr 1 00:55:00 2015
@@ -28,6 +28,7 @@ import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
+import java.util.concurrent.ExecutionException;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicLong;
import java.util.concurrent.atomic.AtomicReference;
@@ -957,12 +958,18 @@ public class TestLRUQueryCache extends L
BadQuery query = new BadQuery();
searcher.count(query);
query.i[0] += 1; // change the hashCode!
+
try {
// trigger an eviction
searcher.count(new MatchAllDocsQuery());
fail();
} catch (ConcurrentModificationException e) {
// expected
+ } catch (RuntimeException e) {
+ // expected: wrapped when executor is in use
+ Throwable cause = e.getCause();
+ assertTrue(cause instanceof ExecutionException);
+ assertTrue(cause.getCause() instanceof ConcurrentModificationException);
}
IOUtils.close(w, reader, dir);
Modified: lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/index/ThreadedIndexingAndSearchingTestCase.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/index/ThreadedIndexingAndSearchingTestCase.java?rev=1670529&r1=1670528&r2=1670529&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/index/ThreadedIndexingAndSearchingTestCase.java (original)
+++ lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/index/ThreadedIndexingAndSearchingTestCase.java Wed Apr 1 00:55:00 2015
@@ -309,7 +309,6 @@ public abstract class ThreadedIndexingAn
doAfterIndexingThreadDone();
}
};
- threads[thread].setDaemon(true);
threads[thread].start();
}
@@ -332,7 +331,7 @@ public abstract class ThreadedIndexingAn
if (VERBOSE) {
System.out.println(Thread.currentThread().getName() + ": launch search thread");
}
- while (System.currentTimeMillis() < stopTimeMS) {
+ while (System.currentTimeMillis() < stopTimeMS && !failed.get()) {
try {
final IndexSearcher s = getCurrentSearcher();
try {
@@ -399,12 +398,11 @@ public abstract class ThreadedIndexingAn
}
}
};
- searchThreads[thread].setDaemon(true);
searchThreads[thread].start();
}
- for(int thread=0;thread<searchThreads.length;thread++) {
- searchThreads[thread].join();
+ for(Thread thread : searchThreads) {
+ thread.join();
}
if (VERBOSE) {
@@ -535,8 +533,8 @@ public abstract class ThreadedIndexingAn
System.out.println("TEST: all searching done [" + (System.currentTimeMillis()-t0) + " ms]");
}
- for(int thread=0;thread<indexThreads.length;thread++) {
- indexThreads[thread].join();
+ for(Thread thread : indexThreads) {
+ thread.join();
}
if (VERBOSE) {
Modified: lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/util/LineFileDocs.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/util/LineFileDocs.java?rev=1670529&r1=1670528&r2=1670529&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/util/LineFileDocs.java (original)
+++ lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/util/LineFileDocs.java Wed Apr 1 00:55:00 2015
@@ -146,7 +146,8 @@ public class LineFileDocs implements Clo
}
public synchronized void reset(Random random) throws IOException {
- close();
+ reader.close();
+ reader = null;
open(random);
id.set(0);
}
@@ -215,7 +216,8 @@ public class LineFileDocs implements Clo
if (LuceneTestCase.VERBOSE) {
System.out.println("TEST: LineFileDocs: now rewind file...");
}
- close();
+ reader.close();
+ reader = null;
open(null);
line = reader.readLine();
}