You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by mk...@apache.org on 2018/04/18 12:40:54 UTC

lucene-solr:branch_7x: SOLR-12155: making TestUnInvertedFieldException more thread-safe

Repository: lucene-solr
Updated Branches:
  refs/heads/branch_7x 1b5690203 -> 46f71e8ae


SOLR-12155: making TestUnInvertedFieldException more thread-safe


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/46f71e8a
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/46f71e8a
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/46f71e8a

Branch: refs/heads/branch_7x
Commit: 46f71e8ae29773cf1af77ed890d14dd7d4e989c1
Parents: 1b56902
Author: Mikhail Khludnev <mk...@apache.org>
Authored: Wed Apr 18 14:57:49 2018 +0300
Committer: Mikhail Khludnev <mk...@apache.org>
Committed: Wed Apr 18 15:29:10 2018 +0300

----------------------------------------------------------------------
 solr/CHANGES.txt                                             | 3 ++-
 .../apache/solr/request/TestUnInvertedFieldException.java    | 8 +++++---
 2 files changed, 7 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/46f71e8a/solr/CHANGES.txt
----------------------------------------------------------------------
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index e93b624..0a9352d 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -124,7 +124,8 @@ Bug Fixes
 * SOLR-12207: Just rethrowing AssertionError caused by jdk bug in reflection with invocation details.
  (ab, Dawid Weiss, Mikhail Khludnev)
 
-* SOLR-12155: Exception from UnInvertedField constructor puts threads to infinite wait. (Mikhail Khludnev)
+* SOLR-12155: Exception from UnInvertedField constructor puts threads to infinite wait.
+ (Andrey Kudryavtsev, Mikhail Khludnev)
 
 * SOLR-12201: TestReplicationHandler.doTestIndexFetchOnMasterRestart(): handle unexpected replication failures
   (Steve Rowe)

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/46f71e8a/solr/core/src/test/org/apache/solr/request/TestUnInvertedFieldException.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/request/TestUnInvertedFieldException.java b/solr/core/src/test/org/apache/solr/request/TestUnInvertedFieldException.java
index 56addf6..f927baf 100644
--- a/solr/core/src/test/org/apache/solr/request/TestUnInvertedFieldException.java
+++ b/solr/core/src/test/org/apache/solr/request/TestUnInvertedFieldException.java
@@ -34,6 +34,7 @@ import org.apache.solr.SolrTestCaseJ4;
 import org.apache.solr.common.SolrException;
 import org.apache.solr.common.SolrException.ErrorCode;
 import org.apache.solr.common.util.ExecutorUtil.MDCAwareThreadPoolExecutor;
+import org.apache.solr.search.SolrIndexSearcher;
 import org.apache.solr.search.facet.UnInvertedField;
 import org.apache.solr.util.TestInjection;
 import org.junit.After;
@@ -78,10 +79,11 @@ public class TestUnInvertedFieldException extends SolrTestCaseJ4 {
   @Test
   public void testConcurrentInit() throws Exception {
     final SolrQueryRequest req = req("*:*");
+    final SolrIndexSearcher searcher = req.getSearcher();
 
     List<Callable<UnInvertedField>> initCallables = new ArrayList<>();
     for (int i=0;i< TestUtil.nextInt(random(), 10, 30);i++) {
-      initCallables.add(()-> UnInvertedField.getUnInvertedField(proto.field(), req.getSearcher()));
+      initCallables.add(()-> UnInvertedField.getUnInvertedField(proto.field(), searcher));
     }
 
     final ThreadPoolExecutor pool  = new MDCAwareThreadPoolExecutor(3, 
@@ -101,7 +103,7 @@ public class TestUnInvertedFieldException extends SolrTestCaseJ4 {
             assertEquals(ErrorCode.SERVER_ERROR.code, solrException.code());
             assertSame(solrException.getCause().getClass(), OutOfMemoryError.class);
           }
-          assertNull(UnInvertedField.checkUnInvertedField(proto.field(), req.getSearcher()));
+          assertNull(UnInvertedField.checkUnInvertedField(proto.field(), searcher));
         }
         TestInjection.uifOutOfMemoryError = false;
       }
@@ -111,7 +113,7 @@ public class TestUnInvertedFieldException extends SolrTestCaseJ4 {
       for (Future<UnInvertedField> uifuture : futures) {
         final UnInvertedField uif = uifuture.get();
         assertNotNull(uif);
-        assertSame(uif, UnInvertedField.checkUnInvertedField(proto.field(), req.getSearcher()));
+        assertSame(uif, UnInvertedField.checkUnInvertedField(proto.field(), searcher));
         if (prev != null) {
           assertSame(prev, uif);
         }