lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rm...@apache.org
Subject svn commit: r1670548 - in /lucene/dev/branches/lucene_solr_5_1/lucene: core/src/test/org/apache/lucene/search/ test-framework/src/java/org/apache/lucene/index/ test-framework/src/java/org/apache/lucene/util/
Date Wed, 01 Apr 2015 03:05:43 GMT
Author: rmuir
Date: Wed Apr  1 03:05:43 2015
New Revision: 1670548

URL: http://svn.apache.org/r1670548
Log:
merge unrelated nightly test bugfixes from LUCENE-6271 branch

Modified:
    lucene/dev/branches/lucene_solr_5_1/lucene/core/src/test/org/apache/lucene/search/TestLRUQueryCache.java
    lucene/dev/branches/lucene_solr_5_1/lucene/test-framework/src/java/org/apache/lucene/index/ThreadedIndexingAndSearchingTestCase.java
    lucene/dev/branches/lucene_solr_5_1/lucene/test-framework/src/java/org/apache/lucene/util/LineFileDocs.java

Modified: lucene/dev/branches/lucene_solr_5_1/lucene/core/src/test/org/apache/lucene/search/TestLRUQueryCache.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene_solr_5_1/lucene/core/src/test/org/apache/lucene/search/TestLRUQueryCache.java?rev=1670548&r1=1670547&r2=1670548&view=diff
==============================================================================
--- lucene/dev/branches/lucene_solr_5_1/lucene/core/src/test/org/apache/lucene/search/TestLRUQueryCache.java
(original)
+++ lucene/dev/branches/lucene_solr_5_1/lucene/core/src/test/org/apache/lucene/search/TestLRUQueryCache.java
Wed Apr  1 03:05:43 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;
@@ -976,12 +977,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/branches/lucene_solr_5_1/lucene/test-framework/src/java/org/apache/lucene/index/ThreadedIndexingAndSearchingTestCase.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene_solr_5_1/lucene/test-framework/src/java/org/apache/lucene/index/ThreadedIndexingAndSearchingTestCase.java?rev=1670548&r1=1670547&r2=1670548&view=diff
==============================================================================
--- lucene/dev/branches/lucene_solr_5_1/lucene/test-framework/src/java/org/apache/lucene/index/ThreadedIndexingAndSearchingTestCase.java
(original)
+++ lucene/dev/branches/lucene_solr_5_1/lucene/test-framework/src/java/org/apache/lucene/index/ThreadedIndexingAndSearchingTestCase.java
Wed Apr  1 03:05:43 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/branches/lucene_solr_5_1/lucene/test-framework/src/java/org/apache/lucene/util/LineFileDocs.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene_solr_5_1/lucene/test-framework/src/java/org/apache/lucene/util/LineFileDocs.java?rev=1670548&r1=1670547&r2=1670548&view=diff
==============================================================================
--- lucene/dev/branches/lucene_solr_5_1/lucene/test-framework/src/java/org/apache/lucene/util/LineFileDocs.java
(original)
+++ lucene/dev/branches/lucene_solr_5_1/lucene/test-framework/src/java/org/apache/lucene/util/LineFileDocs.java
Wed Apr  1 03:05:43 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();
       }



Mime
View raw message