Apache Solr open-source search software
SOLR-5710: Migrate collection command does not handle not finding a shard leader well
Shalin Shekhar Mangar9b46f41aa23b
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txtindex 89bf8b3229b..0b59a79c259 100644--- a/solr/CHANGES.txt+++ b/solr/CHANGES.txt@@ -78,8 +78,8 @@ Detailed Change ListNew Features-----------------------* SOLR-5308: SOLR-5601: A new 'migrate' collection API to split all documents with a- route key into another collection (shalin)+* SOLR-5308: SOLR-5601: SOLR-5710: A new 'migrate' collection API to split all+ documents with a route key into another collection (shalin)* SOLR-5441: Expose number of transaction log files and their size via JMX.(Rafał Kuć via shalin)diff --git a/solr/core/src/java/org/apache/solr/cloud/OverseerCollectionProcessor.java b/solr/core/src/java/org/apache/solr/cloud/OverseerCollectionProcessor.javaindex 6d8c090cfcc..f1abce6837f 100644--- a/solr/core/src/java/org/apache/solr/cloud/OverseerCollectionProcessor.java+++ b/solr/core/src/java/org/apache/solr/cloud/OverseerCollectionProcessor.java@@ -1353,7 +1353,7 @@ public class OverseerCollectionProcessor implements Runnable, ClosableThread {}log.info("Common hash range between source shard: {} and target shard: {} = " + splitRange, sourceSlice.getName(), targetSlice.getName());- Replica targetLeader = targetSlice.getLeader();+ Replica targetLeader = zkStateReader.getLeaderRetry(targetCollection.getName(), targetSlice.getName(), 10000);log.info("Asking target leader node: " + targetLeader.getNodeName() + " core: "+ targetLeader.getStr("core") + " to buffer updates");@@ -1397,7 +1397,7 @@ public class OverseerCollectionProcessor implements Runnable, ClosableThread {log.info("Routing rule added successfully");// Create temp core on source shard- Replica sourceLeader = sourceSlice.getLeader();+ Replica sourceLeader = zkStateReader.getLeaderRetry(sourceCollection.getName(), sourceSlice.getName(), 10000);// create a temporary collection with just one node on the shard leaderString configName = zkStateReader.readConfigName(sourceCollection.getName());@@ -1413,7 +1413,7 @@ public class OverseerCollectionProcessor implements Runnable, ClosableThread {// refresh cluster stateclusterState = zkStateReader.getClusterState();Slice tempSourceSlice = clusterState.getCollection(tempSourceCollectionName).getSlices().iterator().next();- Replica tempSourceLeader = zkStateReader.getLeaderRetry(tempSourceCollectionName, tempSourceSlice.getName(), 60000);+ Replica tempSourceLeader = zkStateReader.getLeaderRetry(tempSourceCollectionName, tempSourceSlice.getName(), 120000);String tempCollectionReplica1 = tempSourceCollectionName + "_" + tempSourceSlice.getName() + "_replica1";String coreNodeName = waitForCoreNodeName(clusterState.getCollection(tempSourceCollectionName),