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/13 01:26:21 UTC
[lucene-solr] branch reference_impl updated: #108 Buff a test,
tweak idle thread timeout.
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
The following commit(s) were added to refs/heads/reference_impl by this push:
new 88da823 #108 Buff a test, tweak idle thread timeout.
88da823 is described below
commit 88da82344a0a8082eff8c77a19b08bc481d1aef7
Author: markrmiller@gmail.com <ma...@gmail.com>
AuthorDate: Sun Jul 12 20:26:08 2020 -0500
#108 Buff a test, tweak idle thread timeout.
---
.../TestCollectionsAPIViaSolrCloudCluster.java | 92 +++++++++++++++++-----
.../src/java/org/apache/solr/common/ParWork.java | 2 +-
2 files changed, 75 insertions(+), 19 deletions(-)
diff --git a/solr/core/src/test/org/apache/solr/cloud/api/collections/TestCollectionsAPIViaSolrCloudCluster.java b/solr/core/src/test/org/apache/solr/cloud/api/collections/TestCollectionsAPIViaSolrCloudCluster.java
index bd1e6b8..548499c 100644
--- a/solr/core/src/test/org/apache/solr/cloud/api/collections/TestCollectionsAPIViaSolrCloudCluster.java
+++ b/solr/core/src/test/org/apache/solr/cloud/api/collections/TestCollectionsAPIViaSolrCloudCluster.java
@@ -36,6 +36,7 @@ import org.apache.solr.client.solrj.request.UpdateRequest;
import org.apache.solr.client.solrj.response.QueryResponse;
import org.apache.solr.cloud.AbstractDistribZkTestBase;
import org.apache.solr.cloud.SolrCloudTestCase;
+import org.apache.solr.common.ParWork;
import org.apache.solr.common.SolrInputDocument;
import org.apache.solr.common.cloud.ClusterState;
import org.apache.solr.common.cloud.DocCollection;
@@ -270,20 +271,58 @@ public class TestCollectionsAPIViaSolrCloudCluster extends SolrCloudTestCase {
final List<Integer> leaderIndicesList = new ArrayList<>(leaderIndices);
final List<Integer> followerIndicesList = new ArrayList<>(followerIndices);
- // first stop the followers (in no particular order)
- Collections.shuffle(followerIndicesList, random());
- for (Integer ii : followerIndicesList) {
- if (!leaderIndices.contains(ii)) {
- cluster.stopJettySolrRunner(jettys.get(ii));
+ if (TEST_NIGHTLY) {
+ // first stop the followers (in no particular order)
+ Collections.shuffle(followerIndicesList, random());
+ for (Integer ii : followerIndicesList) {
+ if (!leaderIndices.contains(ii)) {
+ cluster.stopJettySolrRunner(jettys.get(ii));
+ }
+ }
+ } else {
+ try (ParWork worker = new ParWork(this)) {
+
+ // first stop the followers (in no particular order)
+ Collections.shuffle(followerIndicesList, random());
+ for (Integer ii : followerIndicesList) {
+ if (!leaderIndices.contains(ii)) {
+ worker.collect(() -> {
+ try {
+ cluster.stopJettySolrRunner(jettys.get(ii));
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ });
+ }
+ }
+ worker.addCollect("stopJettysFollowers");
}
}
+ if (TEST_NIGHTLY) {
+ // then stop the leaders (again in no particular order)
+ Collections.shuffle(leaderIndicesList, random());
+ for (Integer ii : leaderIndicesList) {
+ cluster.stopJettySolrRunner(jettys.get(ii));
+ }
+ } else {
+ try (ParWork worker = new ParWork(this)) {
+ // first stop the followers (in no particular order)
+ Collections.shuffle(leaderIndicesList, random());
+ for (Integer ii : leaderIndicesList) {
+ worker.collect(() -> {
+ try {
+ cluster.stopJettySolrRunner(jettys.get(ii));
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ });
+ }
+ worker.addCollect("stopJettysFollowers");
+ }
- // then stop the leaders (again in no particular order)
- Collections.shuffle(leaderIndicesList, random());
- for (Integer ii : leaderIndicesList) {
- cluster.stopJettySolrRunner(jettys.get(ii));
}
+
// calculate restart order
final List<Integer> restartIndicesList = new ArrayList<>();
Collections.shuffle(leaderIndicesList, random());
@@ -292,19 +331,36 @@ public class TestCollectionsAPIViaSolrCloudCluster extends SolrCloudTestCase {
restartIndicesList.addAll(followerIndicesList);
if (random().nextBoolean()) Collections.shuffle(restartIndicesList, random());
- // and then restart jettys in that order
- for (Integer ii : restartIndicesList) {
- final JettySolrRunner jetty = jettys.get(ii);
- if (!jetty.isRunning()) {
- cluster.startJettySolrRunner(jetty);
- assertTrue(jetty.isRunning());
+ if (TEST_NIGHTLY) {
+ // and then restart jettys in that order
+ for (Integer ii : restartIndicesList) {
+ final JettySolrRunner jetty = jettys.get(ii);
+ if (!jetty.isRunning()) {
+ cluster.startJettySolrRunner(jetty);
+ assertTrue(jetty.isRunning());
+ }
+ }
+ } else {
+ try (ParWork worker = new ParWork(this)) {
+ for (Integer ii : restartIndicesList) {
+ final JettySolrRunner jetty = jettys.get(ii);
+ if (!jetty.isRunning()) {
+ worker.collect(() -> {
+ try {
+ cluster.startJettySolrRunner(jetty);
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ assertTrue(jetty.isRunning());
+ });
+
+ }
+ }
+ worker.addCollect("startJettys");
}
}
- cluster.waitForAllNodes(30);
cluster.waitForActiveCollection(collectionName, numShards, numShards * numReplicas);
- zkStateReader.forceUpdateCollection(collectionName);
-
// re-query collection
assertEquals(numDocs, client.query(collectionName, query).getResults().getNumFound());
}
diff --git a/solr/solrj/src/java/org/apache/solr/common/ParWork.java b/solr/solrj/src/java/org/apache/solr/common/ParWork.java
index 9d1223b..acafafe 100644
--- a/solr/solrj/src/java/org/apache/solr/common/ParWork.java
+++ b/solr/solrj/src/java/org/apache/solr/common/ParWork.java
@@ -65,7 +65,7 @@ public class ParWork implements Closeable {
protected final static ThreadLocal<ExecutorService> THREAD_LOCAL_EXECUTOR = new ThreadLocal<>();
public static volatile int MAXIMUM_POOL_SIZE;
- public static final long KEEP_ALIVE_TIME = 10L;
+ public static final long KEEP_ALIVE_TIME = 3;
public static volatile int CAPACITY;
private Set<Object> collectSet = null;