SOLR-12679: MiniSolrCloudCluster.stopJettySolrRunner should remove jetty from the internal list

While the startJettySolrRunner adds the given jetty instance to the internal list of jetty instances, the stopJettySolrRunner method does not remove the given instance from the list. This leads to inconsistencies such as stopped jettys retained in the internal list and duplicate (stopped) jettys. This commit also fixes TestCollectionsAPIViaSolrCloudCluster to deal with this change.
This commit is contained in:
Shalin Shekhar Mangar 2018-08-20 13:17:05 +05:30
parent 3e4545219e
commit ee498f5a38
3 changed files with 10 additions and 1 deletions

View File

@ -247,6 +247,8 @@ Bug Fixes
* SOLR-12674: RollupStream should not use the HashQueryParser for 1 worker. (Varun Thacker)
* SOLR-12679: MiniSolrCloudCluster.stopJettySolrRunner should remove jetty from the internal list. (shalin)
Optimizations
----------------------

View File

@ -205,7 +205,7 @@ public class TestCollectionsAPIViaSolrCloudCluster extends SolrCloudTestCase {
final CloudSolrClient client = cluster.getSolrClient();
assertNotNull(cluster.getZkServer());
List<JettySolrRunner> jettys = cluster.getJettySolrRunners();
List<JettySolrRunner> jettys = new ArrayList<>(cluster.getJettySolrRunners()); // make a copy
assertEquals(nodeCount, jettys.size());
for (JettySolrRunner jetty : jettys) {
assertTrue(jetty.isRunning());

View File

@ -427,8 +427,15 @@ public class MiniSolrCloudCluster {
return jetty;
}
/**
* Stop the given Solr instance. It will be removed from the cluster's list of running instances.
* @param jetty a {@link JettySolrRunner} to be stopped
* @return the same {@link JettySolrRunner} instance provided to this method
* @throws Exception on error
*/
public JettySolrRunner stopJettySolrRunner(JettySolrRunner jetty) throws Exception {
jetty.stop();
jettys.remove(jetty);
return jetty;
}