Skip to content

Apache Lucene open-source search software

SOLR-6793: ReplicationHandler does not destroy all of it's created SnapPullers.

Mark Robert Miller8213fe8a0ad1
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 4f1cf0c0e44..334da4f94da 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -415,6 +415,9 @@ Bug Fixes
* SOLR-6839: Direct routing with CloudSolrServer will ignore the Overwrite document option.
(Mark Miller)
+* SOLR-6793: ReplicationHandler does not destroy all of it's created SnapPullers.
+ (Mark Miller)
+
Optimizations
----------------------
diff --git a/solr/core/src/java/org/apache/solr/handler/ReplicationHandler.java b/solr/core/src/java/org/apache/solr/handler/ReplicationHandler.java
index ec4bc67824e..91f281326a1 100644
--- a/solr/core/src/java/org/apache/solr/handler/ReplicationHandler.java
+++ b/solr/core/src/java/org/apache/solr/handler/ReplicationHandler.java
@@ -329,11 +329,16 @@ public class ReplicationHandler extends RequestHandlerBase implements SolrCoreAw
if (!snapPullLock.tryLock())
return false;
try {
- tempSnapPuller = snapPuller;
if (masterUrl != null) {
+ if (tempSnapPuller != null && tempSnapPuller != snapPuller) {
+ tempSnapPuller.destroy();
+ }
+
NamedList<Object> nl = solrParams.toNamedList();
nl.remove(SnapPuller.POLL_INTERVAL);
tempSnapPuller = new SnapPuller(nl, this, core);
+ } else {
+ tempSnapPuller = snapPuller;
}
return tempSnapPuller.fetchLatestIndex(core, forceReplication);
} catch (Exception e) {
@@ -1001,6 +1006,9 @@ public class ReplicationHandler extends RequestHandlerBase implements SolrCoreAw
if (snapPuller != null) {
snapPuller.destroy();
}
+ if (tempSnapPuller != null && tempSnapPuller != snapPuller) {
+ tempSnapPuller.destroy();
+ }
}
@Override