You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@solr.apache.org by ma...@apache.org on 2021/11/03 11:29:56 UTC
[solr] branch main updated: SOLR-15647:
TestRebalanceLeaders#testRebalanceLeaders can be abysmally slow. (#367)
This is an automated email from the ASF dual-hosted git repository.
markrmiller pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/solr.git
The following commit(s) were added to refs/heads/main by this push:
new 6320e3f SOLR-15647: TestRebalanceLeaders#testRebalanceLeaders can be abysmally slow. (#367)
6320e3f is described below
commit 6320e3f2bc945780377546f8897674cd6c91b758
Author: Mark Robert Miller <ma...@gmail.com>
AuthorDate: Wed Nov 3 06:29:48 2021 -0500
SOLR-15647: TestRebalanceLeaders#testRebalanceLeaders can be abysmally slow. (#367)
---
.../apache/solr/cloud/TestRebalanceLeaders.java | 33 +++++++++++++++++++---
1 file changed, 29 insertions(+), 4 deletions(-)
diff --git a/solr/core/src/test/org/apache/solr/cloud/TestRebalanceLeaders.java b/solr/core/src/test/org/apache/solr/cloud/TestRebalanceLeaders.java
index 3e9956f..0ce5b70 100644
--- a/solr/core/src/test/org/apache/solr/cloud/TestRebalanceLeaders.java
+++ b/solr/core/src/test/org/apache/solr/cloud/TestRebalanceLeaders.java
@@ -19,6 +19,7 @@ package org.apache.solr.cloud;
import java.io.IOException;
import java.lang.invoke.MethodHandles;
import java.util.*;
+import java.util.concurrent.ExecutorService;
import java.util.concurrent.TimeUnit;
import org.apache.lucene.util.LuceneTestCase;
@@ -33,6 +34,7 @@ import org.apache.solr.common.cloud.Replica;
import org.apache.solr.common.cloud.Slice;
import org.apache.solr.common.params.CollectionParams;
import org.apache.solr.common.params.ModifiableSolrParams;
+import org.apache.solr.common.util.ExecutorUtil;
import org.apache.solr.common.util.TimeSource;
import org.apache.solr.util.TimeOut;
import org.apache.zookeeper.KeeperException;
@@ -180,7 +182,7 @@ public class TestRebalanceLeaders extends SolrCloudTestCase {
break;
}
- TimeUnit.MILLISECONDS.sleep(100);
+ TimeUnit.MILLISECONDS.sleep(50);
}
if (count != 1 || rightRep == false) {
fail("The property " + prop + " was not uniquely distributed in slice " + slice.getName()
@@ -202,7 +204,7 @@ public class TestRebalanceLeaders extends SolrCloudTestCase {
checkElectionQueues();
return;
}
- TimeUnit.MILLISECONDS.sleep(100);
+ TimeUnit.MILLISECONDS.sleep(50);
}
log.error("Leaders are not all preferres {}", cluster.getSolrClient().getZkStateReader().getClusterState().getCollection(COLLECTION_NAME));
@@ -489,18 +491,41 @@ public class TestRebalanceLeaders extends SolrCloudTestCase {
// Now we have a list of jettys, and there is one missing. Stop all of the remaining jettys, then start them again
// to concentrate the leaders. It's not necessary that all shards have a leader.
+ ExecutorService executorService = ExecutorUtil.newMDCAwareCachedThreadPool("Start Jetty");
+
+ for (JettySolrRunner jetty : jettys) {
+ cluster.stopJettySolrRunner(jetty);
+ }
+
+ ExecutorUtil.shutdownAndAwaitTermination(executorService);
+
for (JettySolrRunner jetty : jettys) {
cluster.stopJettySolrRunner(jetty);
+ }
+
+
+ for (JettySolrRunner jetty : jettys) {
cluster.waitForJettyToStop(jetty);
}
checkReplicasInactive(jettys);
+ executorService = ExecutorUtil.newMDCAwareCachedThreadPool("Start Jetty");
+
for (int idx = 0; idx < jettys.size(); ++idx) {
- cluster.startJettySolrRunner(jettys.get(idx));
+ int finalIdx = idx;
+ executorService.submit(()->{
+ try {
+ cluster.startJettySolrRunner(jettys.get(finalIdx));
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ });
}
cluster.waitForAllNodes(60);
// the nodes are present, but are all replica active?
checkAllReplicasActive();
+
+ ExecutorUtil.shutdownAndAwaitTermination(executorService);
}
// while banging my nead against a wall, I put a lot of force refresh statements in. Want to leave them in
@@ -612,7 +637,7 @@ public class TestRebalanceLeaders extends SolrCloudTestCase {
if (checkdUniquePropPerShard(uniquePropMaps, prop)) {
return uniquePropMaps;
}
- TimeUnit.MILLISECONDS.sleep(100);
+ TimeUnit.MILLISECONDS.sleep(10);
}
fail("There should be exactly one replica with value " + prop + " set to true per shard: "
+ cluster.getSolrClient().getZkStateReader().getClusterState().getCollection(COLLECTION_NAME).toString());