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

[08/40] lucene-solr:jira/solr-11833: SOLR-12155: making TestUnInvertedFieldException more thread-safe

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/dbdedf3e
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/dbdedf3e
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/dbdedf3e

Branch: refs/heads/jira/solr-11833
Commit: dbdedf3e3f4b4f839348cf4759dc65092f7d5baf
Parents: 507c439
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 14:57:49 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/dbdedf3e/solr/CHANGES.txt
----------------------------------------------------------------------
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index c1efc85..df7df15 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -144,7 +144,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/dbdedf3e/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);
         }