You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ma...@apache.org on 2020/07/14 15:56:38 UTC

[lucene-solr] branch reference_impl updated (4e6c6a5 -> bfb4cae)

This is an automated email from the ASF dual-hosted git repository.

markrmiller pushed a change to branch reference_impl
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git.


    from 4e6c6a5  #140 - Add Flakey.
     new 44d298c  #141 - Ignore exceptions on close.
     new 542ea40  #142 - Disable logging stop for now.
     new bfb4cae  #143 - More test executor usage.

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../handler/component/HttpShardHandlerFactory.java |  4 +-
 .../cloud/TestWaitForStateWithJettyShutdowns.java  |  5 +-
 .../CollectionsAPIAsyncDistributedZkTest.java      |  2 -
 .../test/org/apache/solr/core/SolrCoreTest.java    |  3 --
 .../solr/request/TestUnInvertedFieldException.java |  5 --
 .../org/apache/solr/update/AddBlockUpdateTest.java |  2 -
 .../processor/DistributedUpdateProcessorTest.java  |  3 +-
 .../processor/RoutedAliasUpdateProcessorTest.java  |  3 +-
 .../processor/TestDocBasedVersionConstraints.java  | 62 +++++++++++-----------
 .../TimeRoutedAliasUpdateProcessorTest.java        | 52 +++++++++---------
 .../src/java/org/apache/solr/SolrTestCase.java     |  3 +-
 11 files changed, 62 insertions(+), 82 deletions(-)


[lucene-solr] 01/03: #141 - Ignore exceptions on close.

Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

markrmiller pushed a commit to branch reference_impl
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git

commit 44d298c47d3494198c9bcd9887c4185f61f792de
Author: markrmiller@gmail.com <ma...@gmail.com>
AuthorDate: Tue Jul 14 10:37:44 2020 -0500

    #141 - Ignore exceptions on close.
---
 .../org/apache/solr/handler/component/HttpShardHandlerFactory.java    | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/solr/core/src/java/org/apache/solr/handler/component/HttpShardHandlerFactory.java b/solr/core/src/java/org/apache/solr/handler/component/HttpShardHandlerFactory.java
index affb8d4..3ad656c 100644
--- a/solr/core/src/java/org/apache/solr/handler/component/HttpShardHandlerFactory.java
+++ b/solr/core/src/java/org/apache/solr/handler/component/HttpShardHandlerFactory.java
@@ -354,8 +354,8 @@ public class HttpShardHandlerFactory extends ShardHandlerFactory implements org.
 
   @Override
   public void close() {
-    try (ParWork closer = new ParWork(this)) {
-      closer.add("", loadbalancer, defaultClient, () -> {
+    try (ParWork closer = new ParWork(this, true)) {
+      closer.add("closeHttpShardHandlerFactory", loadbalancer, defaultClient, () -> {
         try {
           SolrMetricProducer.super.close();
         } catch (Exception e) {


[lucene-solr] 02/03: #142 - Disable logging stop for now.

Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

markrmiller pushed a commit to branch reference_impl
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git

commit 542ea406e1ef5735495ba382d30e52fff0f43ce5
Author: markrmiller@gmail.com <ma...@gmail.com>
AuthorDate: Tue Jul 14 10:37:59 2020 -0500

    #142 - Disable logging stop for now.
---
 solr/test-framework/src/java/org/apache/solr/SolrTestCase.java | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/solr/test-framework/src/java/org/apache/solr/SolrTestCase.java b/solr/test-framework/src/java/org/apache/solr/SolrTestCase.java
index 80da55a..caa8407 100644
--- a/solr/test-framework/src/java/org/apache/solr/SolrTestCase.java
+++ b/solr/test-framework/src/java/org/apache/solr/SolrTestCase.java
@@ -323,7 +323,8 @@ public class SolrTestCase extends LuceneTestCase {
       HttpClientUtil.resetHttpClientBuilder();
       Http2SolrClient.resetSslContextFactory();
       TestInjection.reset();
-      StartupLoggingUtils.shutdown();
+      // I think  we can avoid this
+      //StartupLoggingUtils.shutdown();
 
       checkForInterruptRequest();
 


[lucene-solr] 03/03: #143 - More test executor usage.

Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

markrmiller pushed a commit to branch reference_impl
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git

commit bfb4caeeae9a6f9a68099e2c59131423163ca317
Author: markrmiller@gmail.com <ma...@gmail.com>
AuthorDate: Tue Jul 14 10:55:31 2020 -0500

    #143 - More test executor usage.
---
 .../cloud/TestWaitForStateWithJettyShutdowns.java  |  5 +-
 .../CollectionsAPIAsyncDistributedZkTest.java      |  2 -
 .../test/org/apache/solr/core/SolrCoreTest.java    |  3 --
 .../solr/request/TestUnInvertedFieldException.java |  5 --
 .../org/apache/solr/update/AddBlockUpdateTest.java |  2 -
 .../processor/DistributedUpdateProcessorTest.java  |  3 +-
 .../processor/RoutedAliasUpdateProcessorTest.java  |  3 +-
 .../processor/TestDocBasedVersionConstraints.java  | 62 +++++++++++-----------
 .../TimeRoutedAliasUpdateProcessorTest.java        | 52 +++++++++---------
 9 files changed, 58 insertions(+), 79 deletions(-)

diff --git a/solr/core/src/test/org/apache/solr/cloud/TestWaitForStateWithJettyShutdowns.java b/solr/core/src/test/org/apache/solr/cloud/TestWaitForStateWithJettyShutdowns.java
index 4e335f2..bbaf57f 100644
--- a/solr/core/src/test/org/apache/solr/cloud/TestWaitForStateWithJettyShutdowns.java
+++ b/solr/core/src/test/org/apache/solr/cloud/TestWaitForStateWithJettyShutdowns.java
@@ -79,8 +79,7 @@ public class TestWaitForStateWithJettyShutdowns extends SolrTestCaseJ4 {
 
   public void testWaitForStateBeforeShutDown() throws Exception {
     final String col_name = "test_col";
-    final ExecutorService executor = ExecutorUtil.newMDCAwareFixedThreadPool
-      (1, new SolrNamedThreadFactory("background_executor"));
+    final ExecutorService executor = testExecutor;
     final MiniSolrCloudCluster cluster = new MiniSolrCloudCluster
       (1, createTempDir(), buildJettyConfig("/solr"));
     try {
@@ -116,7 +115,7 @@ public class TestWaitForStateWithJettyShutdowns extends SolrTestCaseJ4 {
         }, null);
       
       log.info("Awaiting latch...");
-      if (! latch.await(120, TimeUnit.SECONDS)) {
+      if (! latch.await(15, TimeUnit.SECONDS)) {
         fail("timed out Waiting a ridiculous amount of time for the waitForState latch -- did impl change?");
       }
 
diff --git a/solr/core/src/test/org/apache/solr/cloud/api/collections/CollectionsAPIAsyncDistributedZkTest.java b/solr/core/src/test/org/apache/solr/cloud/api/collections/CollectionsAPIAsyncDistributedZkTest.java
index 96926d4..e0db8e3 100644
--- a/solr/core/src/test/org/apache/solr/cloud/api/collections/CollectionsAPIAsyncDistributedZkTest.java
+++ b/solr/core/src/test/org/apache/solr/cloud/api/collections/CollectionsAPIAsyncDistributedZkTest.java
@@ -41,8 +41,6 @@ import org.apache.solr.common.SolrInputDocument;
 import org.apache.solr.common.cloud.Replica;
 import org.apache.solr.common.cloud.Slice;
 import org.apache.solr.common.cloud.ZkStateReader;
-import org.apache.solr.common.util.ExecutorUtil;
-import org.apache.solr.common.util.SolrNamedThreadFactory;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Ignore;
diff --git a/solr/core/src/test/org/apache/solr/core/SolrCoreTest.java b/solr/core/src/test/org/apache/solr/core/SolrCoreTest.java
index 9dcc821..b56d5b9 100644
--- a/solr/core/src/test/org/apache/solr/core/SolrCoreTest.java
+++ b/solr/core/src/test/org/apache/solr/core/SolrCoreTest.java
@@ -288,9 +288,6 @@ public class SolrCoreTest extends SolrTestCaseJ4 {
     // and close it when we call reload.
     h.reload();
 
-    executor.shutdown();
-    executor.awaitTermination(1, TimeUnit.MINUTES);
-
     // Check that all cores are closed and no searcher references are leaked.
     assertTrue("SolrCore " + core + " is not closed", core.isClosed());
   }
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 37ae4f1..bfbdd1c 100644
--- a/solr/core/src/test/org/apache/solr/request/TestUnInvertedFieldException.java
+++ b/solr/core/src/test/org/apache/solr/request/TestUnInvertedFieldException.java
@@ -23,18 +23,13 @@ import java.util.concurrent.Callable;
 import java.util.concurrent.ExecutionException;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Future;
-import java.util.concurrent.LinkedBlockingQueue;
-import java.util.concurrent.ThreadPoolExecutor;
-import java.util.concurrent.TimeUnit;
 import java.util.stream.Collectors;
 
 import org.apache.lucene.index.Term;
-import org.apache.lucene.util.NamedThreadFactory;
 import org.apache.lucene.util.TestUtil;
 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;
diff --git a/solr/core/src/test/org/apache/solr/update/AddBlockUpdateTest.java b/solr/core/src/test/org/apache/solr/update/AddBlockUpdateTest.java
index b4c9737..91bcbeb 100644
--- a/solr/core/src/test/org/apache/solr/update/AddBlockUpdateTest.java
+++ b/solr/core/src/test/org/apache/solr/update/AddBlockUpdateTest.java
@@ -59,14 +59,12 @@ import org.apache.solr.client.solrj.request.UpdateRequest;
 import org.apache.solr.common.SolrException;
 import org.apache.solr.common.SolrInputDocument;
 import org.apache.solr.common.params.ModifiableSolrParams;
-import org.apache.solr.common.util.ExecutorUtil;
 import org.apache.solr.common.util.JavaBinCodec;
 import org.apache.solr.handler.loader.XMLLoader;
 import org.apache.solr.request.LocalSolrQueryRequest;
 import org.apache.solr.request.SolrQueryRequest;
 import org.apache.solr.rest.schema.FieldTypeXmlAdapter;
 import org.apache.solr.search.SolrIndexSearcher;
-import org.apache.solr.common.util.SolrNamedThreadFactory;
 import org.apache.solr.util.RefCounted;
 import org.junit.After;
 import org.junit.AfterClass;
diff --git a/solr/core/src/test/org/apache/solr/update/processor/DistributedUpdateProcessorTest.java b/solr/core/src/test/org/apache/solr/update/processor/DistributedUpdateProcessorTest.java
index 47a49b5..d162fa4 100644
--- a/solr/core/src/test/org/apache/solr/update/processor/DistributedUpdateProcessorTest.java
+++ b/solr/core/src/test/org/apache/solr/update/processor/DistributedUpdateProcessorTest.java
@@ -29,7 +29,6 @@ import java.util.function.Function;
 import org.apache.solr.SolrTestCaseJ4;
 import org.apache.solr.common.SolrInputDocument;
 import org.apache.solr.common.params.ModifiableSolrParams;
-import org.apache.solr.common.util.ExecutorUtil;
 import org.apache.solr.request.LocalSolrQueryRequest;
 import org.apache.solr.request.SolrQueryRequest;
 import org.apache.solr.update.AddUpdateCommand;
@@ -60,7 +59,7 @@ public class DistributedUpdateProcessorTest extends SolrTestCaseJ4 {
   @BeforeClass
   public static void beforeClass() throws Exception {
     assumeWorkingMockito();
-    executor = ExecutorUtil.newMDCAwareCachedThreadPool(getClassName());
+    executor = testExecutor;
     System.setProperty("enable.update.log", "true");
     initCore("solr/collection1/conf/solrconfig.xml","solr/collection1/conf/schema-minimal-with-another-uniqkey.xml");
   }
diff --git a/solr/core/src/test/org/apache/solr/update/processor/RoutedAliasUpdateProcessorTest.java b/solr/core/src/test/org/apache/solr/update/processor/RoutedAliasUpdateProcessorTest.java
index 69eeadb..a694ae8 100644
--- a/solr/core/src/test/org/apache/solr/update/processor/RoutedAliasUpdateProcessorTest.java
+++ b/solr/core/src/test/org/apache/solr/update/processor/RoutedAliasUpdateProcessorTest.java
@@ -272,8 +272,7 @@ public abstract class RoutedAliasUpdateProcessorTest extends SolrCloudTestCase {
       ExecutorService exec = null;
       try (CloudSolrClient solrClient = getCloudSolrClient(cluster)) {
         try {
-          exec = ExecutorUtil.newMDCAwareFixedThreadPool(1 + random().nextInt(2),
-              new SolrNamedThreadFactory(getSaferTestName()));
+          exec = testExecutor;
           List<Future<UpdateResponse>> futures = new ArrayList<>(solrInputDocuments.length);
           for (SolrInputDocument solrInputDocument : solrInputDocuments) {
             String col = collections.get(random().nextInt(collections.size()));
diff --git a/solr/core/src/test/org/apache/solr/update/processor/TestDocBasedVersionConstraints.java b/solr/core/src/test/org/apache/solr/update/processor/TestDocBasedVersionConstraints.java
index 5132a9b..663d19d 100644
--- a/solr/core/src/test/org/apache/solr/update/processor/TestDocBasedVersionConstraints.java
+++ b/solr/core/src/test/org/apache/solr/update/processor/TestDocBasedVersionConstraints.java
@@ -445,42 +445,40 @@ public class TestDocBasedVersionConstraints extends SolrTestCaseJ4 {
   public void testConcurrentAdds() throws Exception {
     final int NUM_DOCS = atLeast(50);
     final int MAX_CONCURENT = atLeast(10);
-    ExecutorService runner = ExecutorUtil.newMDCAwareFixedThreadPool(MAX_CONCURENT, new SolrNamedThreadFactory("TestDocBasedVersionConstraints"));
+    ExecutorService runner = testExecutor;
     // runner = Executors.newFixedThreadPool(1);    // to test single threaded
-    try {
-      for (int id = 0; id < NUM_DOCS; id++) {
-        final int numAdds = TestUtil.nextInt(random(), 3, MAX_CONCURENT);
-        final int winner = TestUtil.nextInt(random(), 0, numAdds - 1);
-        final int winnerVersion = atLeast(100);
-        final boolean winnerIsDeleted = (0 == TestUtil.nextInt(random(), 0, 4));
-        List<Callable<Object>> tasks = new ArrayList<>(numAdds);
-        for (int variant = 0; variant < numAdds; variant++) {
-          final boolean iShouldWin = (variant==winner);
-          final long version = (iShouldWin ? winnerVersion 
-                                : TestUtil.nextInt(random(), 1, winnerVersion - 1));
-          if ((iShouldWin && winnerIsDeleted)
-              || (!iShouldWin && 0 == TestUtil.nextInt(random(), 0, 4))) {
-            tasks.add(delayedDelete(""+id, ""+version));
-          } else {
-            tasks.add(delayedAdd("id",""+id,"name","name"+id+"_"+variant,
-                                 "my_version_l", ""+ version));
-          }
+
+    for (int id = 0; id < NUM_DOCS; id++) {
+      final int numAdds = TestUtil.nextInt(random(), 3, MAX_CONCURENT);
+      final int winner = TestUtil.nextInt(random(), 0, numAdds - 1);
+      final int winnerVersion = atLeast(100);
+      final boolean winnerIsDeleted = (0 == TestUtil.nextInt(random(), 0, 4));
+      List<Callable<Object>> tasks = new ArrayList<>(numAdds);
+      for (int variant = 0; variant < numAdds; variant++) {
+        final boolean iShouldWin = (variant == winner);
+        final long version = (iShouldWin ? winnerVersion
+                : TestUtil.nextInt(random(), 1, winnerVersion - 1));
+        if ((iShouldWin && winnerIsDeleted)
+                || (!iShouldWin && 0 == TestUtil.nextInt(random(), 0, 4))) {
+          tasks.add(delayedDelete("" + id, "" + version));
+        } else {
+          tasks.add(delayedAdd("id", "" + id, "name", "name" + id + "_" + variant,
+                  "my_version_l", "" + version));
         }
-        runner.invokeAll(tasks);
-        final String expectedDoc = "{'id':'"+id+"','my_version_l':"+winnerVersion +
-          ( ! winnerIsDeleted ? ",'name':'name"+id+"_"+winner+"'}" : "}");
-
-        assertJQ(req("qt","/get", "id",""+id, "fl","id,name,my_version_l")
-                 , "=={'doc':" + expectedDoc + "}");
-        assertU(commit());
-        assertJQ(req("q","id:"+id,
-                     "fl","id,name,my_version_l")
-                 ,"/response/numFound==1"
-                 ,"/response/docs==["+expectedDoc+"]");
       }
-    } finally {
-      ExecutorUtil.shutdownAndAwaitTermination(runner);
+      runner.invokeAll(tasks);
+      final String expectedDoc = "{'id':'" + id + "','my_version_l':" + winnerVersion +
+              (!winnerIsDeleted ? ",'name':'name" + id + "_" + winner + "'}" : "}");
+
+      assertJQ(req("qt", "/get", "id", "" + id, "fl", "id,name,my_version_l")
+              , "=={'doc':" + expectedDoc + "}");
+      assertU(commit());
+      assertJQ(req("q", "id:" + id,
+              "fl", "id,name,my_version_l")
+              , "/response/numFound==1"
+              , "/response/docs==[" + expectedDoc + "]");
     }
+
   }
 
   public void testMissingVersionOnOldDocs() throws Exception {
diff --git a/solr/core/src/test/org/apache/solr/update/processor/TimeRoutedAliasUpdateProcessorTest.java b/solr/core/src/test/org/apache/solr/update/processor/TimeRoutedAliasUpdateProcessorTest.java
index 7f76453..6a0ff7b 100644
--- a/solr/core/src/test/org/apache/solr/update/processor/TimeRoutedAliasUpdateProcessorTest.java
+++ b/solr/core/src/test/org/apache/solr/update/processor/TimeRoutedAliasUpdateProcessorTest.java
@@ -306,38 +306,34 @@ public class TimeRoutedAliasUpdateProcessorTest extends RoutedAliasUpdateProcess
 
     // Using threads to ensure that two TRA's  are simultaneously preemptively creating and don't
     // interfere with each other
-    ExecutorService executorService = ExecutorUtil.newMDCAwareCachedThreadPool("TimeRoutedAliasProcessorTestx-testPreemptiveCreation");
+    ExecutorService executorService = testExecutor;
 
     Exception[] threadExceptions = new Exception[2];
     boolean[] threadStarted = new boolean[2];
     boolean[] threadFinished = new boolean[2];
-    try {
-      CountDownLatch starter = new CountDownLatch(1);
-      executorService.submit(() -> {
-        threadStarted[0] = true;
-        try {
-          starter.await();
-          concurrentUpdates(params, alias);
-        } catch (Exception e) {
-          threadExceptions[0] = e;
-        }
-        threadFinished[0] = true;
-      });
-
-      executorService.submit(() -> {
-        threadStarted[1] = true;
-        try {
-          starter.await();
-          concurrentUpdates(params, alias2);
-        } catch (Exception e) {
-          threadExceptions[1] = e;
-        }
-        threadFinished[1] = true;
-      });
-      starter.countDown();
-    } finally {
-      ExecutorUtil.shutdownAndAwaitTermination(executorService);
-    }
+    CountDownLatch starter = new CountDownLatch(1);
+    executorService.submit(() -> {
+      threadStarted[0] = true;
+      try {
+        starter.await();
+        concurrentUpdates(params, alias);
+      } catch (Exception e) {
+        threadExceptions[0] = e;
+      }
+      threadFinished[0] = true;
+    });
+
+    executorService.submit(() -> {
+      threadStarted[1] = true;
+      try {
+        starter.await();
+        concurrentUpdates(params, alias2);
+      } catch (Exception e) {
+        threadExceptions[1] = e;
+      }
+      threadFinished[1] = true;
+    });
+    starter.countDown();
 
     // threads are known to be terminated by now, check for exceptions
     for (Exception threadException : threadExceptions) {