Skip to content

Apache Lucene open-source search software

Fix TestCloudSearcherWarming to work around SOLR-13490

Chris Hostetteraf4e1d324a38
diff --git a/solr/core/src/test/org/apache/solr/cloud/TestCloudSearcherWarming.java b/solr/core/src/test/org/apache/solr/cloud/TestCloudSearcherWarming.java
index 24927e06c1a..7376a7358fd 100644
--- a/solr/core/src/test/org/apache/solr/cloud/TestCloudSearcherWarming.java
+++ b/solr/core/src/test/org/apache/solr/cloud/TestCloudSearcherWarming.java
@@ -114,9 +114,12 @@ public class TestCloudSearcherWarming extends SolrCloudTestCase {
JettySolrRunner runner = cluster.getJettySolrRunner(0);
runner.stop();
- waitForState("jetty count:" + cluster.getJettySolrRunners().size(), collectionName, clusterShape(1, 0));
cluster.waitForJettyToStop(runner);
+ // check waitForState only after we are sure the node has shutdown and have forced an update to liveNodes
+ // ie: workaround SOLR-13490
+ cluster.getSolrClient().getZkStateReader().updateLiveNodes();
+ waitForState("jetty count:" + cluster.getJettySolrRunners().size(), collectionName, clusterShape(1, 0));
// restart
sleepTime.set(1000);
@@ -302,8 +305,7 @@ public class TestCloudSearcherWarming extends SolrCloudTestCase {
public static class SleepingSolrEventListener implements SolrEventListener {
@Override
public void init(NamedList args) {
- new RuntimeException().printStackTrace();
- System.out.println(args);
+ // No-Op
}
@Override
@@ -325,7 +327,7 @@ public class TestCloudSearcherWarming extends SolrCloudTestCase {
try {
Thread.sleep(sleepTime.get());
} catch (InterruptedException e) {
- e.printStackTrace();
+ log.warn("newSearcher was interupdated", e);
}
log.info("Finished sleeping for {} on newSearcher: {}, currentSearcher: {} belonging to (newest) core: {}, id: {}", sleepTime.get(), newSearcher, currentSearcher, newSearcher.getCore().getName(), newSearcher.getCore());
}