Skip to content

armgit / solr

Public Imported from GitHub
0

Apache Solr open-source search software

SOLR-8549: start script checks against failed cores as well before attempting to create a core with the same name

Varun Thacker40e0c5bf28c0
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index a1e18a6b756..333213d51dd 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -524,6 +524,9 @@ Other Changes
* SOLR-8535: Support forcing define-lucene-javadoc-url to be local (Gregory Chanan)
+* SOLR-8549: Solr start script checks for cores which have failed to load as well before attempting to
+ create a core with the same name (Varun Thacker)
+
================== 5.4.1 ==================
Bug Fixes
diff --git a/solr/core/src/java/org/apache/solr/util/SolrCLI.java b/solr/core/src/java/org/apache/solr/util/SolrCLI.java
index 79fd05aa654..ac3c4216ca1 100644
--- a/solr/core/src/java/org/apache/solr/util/SolrCLI.java
+++ b/solr/core/src/java/org/apache/solr/util/SolrCLI.java
@@ -1360,7 +1360,9 @@ public class SolrCLI {
Map<String,Object> existsCheckResult = getJson(coreStatusUrl);
Map<String,Object> status = (Map<String, Object>)existsCheckResult.get("status");
Map<String,Object> coreStatus = (Map<String, Object>)status.get(coreName);
- exists = coreStatus != null && coreStatus.containsKey(NAME);
+ Map<String,Object> failureStatus = (Map<String, Object>)existsCheckResult.get("initFailures");
+ String errorMsg = (String) failureStatus.get(coreName);
+ exists = coreStatus != null && coreStatus.containsKey(NAME) || errorMsg != null;
} catch (Exception exc) {
// just ignore it since we're only interested in a positive result here
}
@@ -2284,7 +2286,7 @@ public class SolrCLI {
throw new Exception("Failed to create "+collectionName+" using command: "+ Arrays.asList(createArgs));
}
- if ("techproducts".equals(exampleName)) {
+ if ("techproducts".equals(exampleName) && !alreadyExists) {
File exampledocsDir = new File(exampleDir, "exampledocs");
if (!exampledocsDir.isDirectory()) {