From 8e78a87797a5cf7e6bb52477efc89db51d8945e1 Mon Sep 17 00:00:00 2001 From: "markrmiller@gmail.com" Date: Fri, 10 Jul 2020 11:07:57 -0500 Subject: [PATCH] #50 Knock down a few long tail tests. --- .../org/apache/solr/TestDistributedGrouping.java | 2 +- .../org/apache/solr/TestDistributedSearch.java | 2 +- .../search/TestRandomCollapseQParserPlugin.java | 4 ++-- ...tributedFacetSimpleRefinementLongTailTest.java | 2 +- .../solr/BaseDistributedSearchTestCase.java | 15 +-------------- .../src/java/org/apache/solr/SolrTestCaseJ4.java | 2 +- 6 files changed, 7 insertions(+), 20 deletions(-) diff --git a/solr/core/src/test/org/apache/solr/TestDistributedGrouping.java b/solr/core/src/test/org/apache/solr/TestDistributedGrouping.java index 043d88489041..7763658e1e50 100644 --- a/solr/core/src/test/org/apache/solr/TestDistributedGrouping.java +++ b/solr/core/src/test/org/apache/solr/TestDistributedGrouping.java @@ -146,7 +146,7 @@ public void test() throws Exception { oddField, "odd eggs" ); - for (int i = 100; i < (TEST_NIGHTLY ? 150 : 25); i++) { + for (int i = 100; i < (TEST_NIGHTLY ? 150 : 5); i++) { indexr(id, i); } diff --git a/solr/core/src/test/org/apache/solr/TestDistributedSearch.java b/solr/core/src/test/org/apache/solr/TestDistributedSearch.java index 5ce147adff3b..05bbebf8b45c 100644 --- a/solr/core/src/test/org/apache/solr/TestDistributedSearch.java +++ b/solr/core/src/test/org/apache/solr/TestDistributedSearch.java @@ -1183,7 +1183,7 @@ protected void queryPartialResults(final List upShards, if (stress > 0) { log.info("starting stress..."); Set> pending = new HashSet<>();; - ExecutorCompletionService cs = new ExecutorCompletionService<>(executor); + ExecutorCompletionService cs = new ExecutorCompletionService<>(testExecutor); Callable[] threads = new Callable[nThreads]; for (int i = 0; i < threads.length; i++) { threads[i] = new Callable() { diff --git a/solr/core/src/test/org/apache/solr/search/TestRandomCollapseQParserPlugin.java b/solr/core/src/test/org/apache/solr/search/TestRandomCollapseQParserPlugin.java index 37939a62e8d7..1d5d09fb0eb9 100644 --- a/solr/core/src/test/org/apache/solr/search/TestRandomCollapseQParserPlugin.java +++ b/solr/core/src/test/org/apache/solr/search/TestRandomCollapseQParserPlugin.java @@ -127,7 +127,7 @@ public void testEveryIsolatedSortFieldOnSingleGroup() throws Exception { public void testRandomCollpaseWithSort() throws Exception { - final int numMainQueriesPerCollapseField = atLeast(TEST_NIGHTLY ? 5 : 3); + final int numMainQueriesPerCollapseField = atLeast(TEST_NIGHTLY ? 5 : 2); for (String collapseField : ALL_COLLAPSE_FIELD_NAMES) { for (int i = 0; i < numMainQueriesPerCollapseField; i++) { @@ -140,7 +140,7 @@ public void testRandomCollpaseWithSort() throws Exception { final SolrParams mainP = params("q", q, "fl", "id,"+collapseField); final String csize = random().nextBoolean() ? - "" : " size=" + TestUtil.nextInt(random(),1,TEST_NIGHTLY ? 10000 : 1000); + "" : " size=" + TestUtil.nextInt(random(),1,TEST_NIGHTLY ? 10000 : 10); final String nullPolicy = randomNullPolicy(); final String nullPs = NULL_IGNORE.equals(nullPolicy) diff --git a/solr/core/src/test/org/apache/solr/search/facet/DistributedFacetSimpleRefinementLongTailTest.java b/solr/core/src/test/org/apache/solr/search/facet/DistributedFacetSimpleRefinementLongTailTest.java index a24da43066c8..744693a5f8f7 100644 --- a/solr/core/src/test/org/apache/solr/search/facet/DistributedFacetSimpleRefinementLongTailTest.java +++ b/solr/core/src/test/org/apache/solr/search/facet/DistributedFacetSimpleRefinementLongTailTest.java @@ -122,7 +122,7 @@ public static void buildIndexes(final List clients, final String sta } // really long tail uncommon foo_s terms on shard2 - for (int i = 0; i < 30; i++) { + for (int i = 0; i < (TEST_NIGHTLY ? 30 : 10); i++) { // NOTE: using "Z" here so these sort before bbb0 when they tie for '1' instance each on shard2 shard2.add(sdoc("id", docNum.incrementAndGet(), "foo_s", "ZZZ"+i)); } diff --git a/solr/test-framework/src/java/org/apache/solr/BaseDistributedSearchTestCase.java b/solr/test-framework/src/java/org/apache/solr/BaseDistributedSearchTestCase.java index 1f7e32c252ad..0975bda4fb6a 100644 --- a/solr/test-framework/src/java/org/apache/solr/BaseDistributedSearchTestCase.java +++ b/solr/test-framework/src/java/org/apache/solr/BaseDistributedSearchTestCase.java @@ -98,15 +98,6 @@ */ public abstract class BaseDistributedSearchTestCase extends SolrTestCaseJ4 { - protected ExecutorService executor = new ExecutorUtil.MDCAwareThreadPoolExecutor( - 4, - Integer.MAX_VALUE, - 15, TimeUnit.SECONDS, // terminate idle threads after 15 sec - new SynchronousQueue<>(), // directly hand off tasks - new SolrNamedThreadFactory("BaseDistributedSearchTestCase"), - false - ); - // TODO: this shouldn't be static. get the random when you need it to avoid sharing. public static Random r; @@ -337,7 +328,6 @@ public void distribSetUp() throws Exception { private volatile boolean distribTearDownCalled = false; public void distribTearDown() throws Exception { - ExecutorUtil.shutdownAndAwaitTermination(executor); distribTearDownCalled = true; } @@ -417,10 +407,7 @@ protected void destroyServers() throws Exception { // if (destroyServersCalled) throw new RuntimeException("destroyServers already called"); // destroyServersCalled = true; try (ParWork closer = new ParWork(this, true)) { - - closer.add("clients", controlClient, clients); - - closer.add("jetties", jettys, controlJetty); + closer.add("jetties&clients", controlClient, clients, jettys, controlJetty); } clients.clear(); diff --git a/solr/test-framework/src/java/org/apache/solr/SolrTestCaseJ4.java b/solr/test-framework/src/java/org/apache/solr/SolrTestCaseJ4.java index 90e7111c6d06..e9d40e00d70e 100644 --- a/solr/test-framework/src/java/org/apache/solr/SolrTestCaseJ4.java +++ b/solr/test-framework/src/java/org/apache/solr/SolrTestCaseJ4.java @@ -250,7 +250,7 @@ public static void setupTestCases() { resetExceptionIgnores(); testExecutor = new ExecutorUtil.MDCAwareThreadPoolExecutor(0, Integer.MAX_VALUE, - 15L, TimeUnit.SECONDS, + 5L, TimeUnit.SECONDS, new SynchronousQueue<>(), new SolrNamedThreadFactory("testExecutor"), true);