Skip to content

Apache Lucene open-source search software

SOLR-12146: LIR should skip deleted replicas

Cao Manh Dat160faaf59484
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 1d1a3ff0ce0..a963de85f90 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -96,6 +96,8 @@ Optimizations
* SOLR-11891: DocStreamer now respects the ReturnFields when populating a SolrDocument, reducing the
number of unneccessary fields a ResponseWriter will see if documentCache is used (wei wang, hossman)
+* SOLR-12146: LIR should skip deleted replicas (Cao Manh Dat)
+
Other Changes
----------------------
diff --git a/solr/core/src/java/org/apache/solr/cloud/ZkController.java b/solr/core/src/java/org/apache/solr/cloud/ZkController.java
index 477e5672af8..c0ddd260adf 100644
--- a/solr/core/src/java/org/apache/solr/cloud/ZkController.java
+++ b/solr/core/src/java/org/apache/solr/cloud/ZkController.java
@@ -2175,7 +2175,8 @@ public class ZkController {
}
// we only really need to try to start the LIR process if the node itself is "live"
- if (getZkStateReader().getClusterState().liveNodesContain(replicaNodeName)) {
+ if (getZkStateReader().getClusterState().liveNodesContain(replicaNodeName)
+ && CloudUtil.replicaExists(getZkStateReader().getClusterState(), collection, shardId, replicaCoreNodeName)) {
LeaderInitiatedRecoveryThread lirThread =
new LeaderInitiatedRecoveryThread(this,
@@ -2200,9 +2201,8 @@ public class ZkController {
replicaNodeName + " into leader-initiated recovery.", replicaCoreProps.getCoreName(), replicaCoreNodeName);
} else {
nodeIsLive = false; // we really don't need to send the recovery request if the node is NOT live
- log.info("Node " + replicaNodeName +
- " is not live, so skipping leader-initiated recovery for replica: core={} coreNodeName={}",
- replicaCoreProps.getCoreName(), replicaCoreNodeName);
+ log.info("Node {} is not live or replica {} is deleted, so skipping leader-initiated recovery for replica: core={}",
+ replicaNodeName, replicaCoreNodeName, replicaCoreProps.getCoreName());
// publishDownState will be false to avoid publishing the "down" state too many times
// as many errors can occur together and will each call into this method (SOLR-6189)
}