Skip to content

Apache Lucene open-source search software

SOLR-9392: Fixed CDCR Test failures which were due to leaked resources

Shalin Shekhar Mangarbfee2292a34e
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index cc70459dfed..b497a531635 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -236,6 +236,8 @@ Other Changes
* SOLR-9353: Factor out ReRankQParserPlugin.ReRankQueryRescorer private class. (Christine Poerschke)
+* SOLR-9392: Fixed CDCR Test failures which were due to leaked resources. (shalin)
+
================== 6.1.0 ==================
Consult the LUCENE_CHANGES.txt file for additional, low level, changes in this release.
diff --git a/solr/core/src/test/org/apache/solr/cloud/BaseCdcrDistributedZkTest.java b/solr/core/src/test/org/apache/solr/cloud/BaseCdcrDistributedZkTest.java
index c53532f656e..0ca25aa687a 100644
--- a/solr/core/src/test/org/apache/solr/cloud/BaseCdcrDistributedZkTest.java
+++ b/solr/core/src/test/org/apache/solr/cloud/BaseCdcrDistributedZkTest.java
@@ -49,6 +49,7 @@ import org.apache.solr.common.cloud.ZkStateReader;
import org.apache.solr.common.params.CollectionParams;
import org.apache.solr.common.params.CommonParams;
import org.apache.solr.common.params.ModifiableSolrParams;
+import org.apache.solr.common.util.IOUtils;
import org.apache.solr.common.util.NamedList;
import org.apache.solr.common.util.StrUtils;
import org.apache.solr.common.util.Utils;
@@ -667,6 +668,14 @@ public class BaseCdcrDistributedZkTest extends AbstractDistribZkTestBase {
}
}
+ List<CloudJettyRunner> oldRunners = this.cloudJettys.putIfAbsent(collection, cloudJettys);
+ if (oldRunners != null) {
+ // must close resources for the old entries
+ for (CloudJettyRunner oldRunner : oldRunners) {
+ IOUtils.closeQuietly(oldRunner.client);
+ }
+ }
+
this.cloudJettys.put(collection, cloudJettys);
this.shardToJetty.put(collection, shardToJetty);
this.shardToLeaderJetty.put(collection, shardToLeaderJetty);