lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sar...@apache.org
Subject lucene-solr:branch_6x: SOLR-8801: /bin/solr create script always returns exit code 0 when a collection/core already exists
Date Fri, 20 May 2016 23:37:57 GMT
Repository: lucene-solr
Updated Branches:
  refs/heads/branch_6x 25e913211 -> b4d8e42a1


SOLR-8801: /bin/solr create script always returns exit code 0 when a collection/core already
exists


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/b4d8e42a
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/b4d8e42a
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/b4d8e42a

Branch: refs/heads/branch_6x
Commit: b4d8e42a1f0044c4d0a20967c2ec48b393eff39d
Parents: 25e9132
Author: Steve Rowe <sarowe@apache.org>
Authored: Fri May 20 19:36:39 2016 -0400
Committer: Steve Rowe <sarowe@apache.org>
Committed: Fri May 20 19:37:37 2016 -0400

----------------------------------------------------------------------
 solr/CHANGES.txt                                                 | 3 +++
 solr/core/src/java/org/apache/solr/util/SolrCLI.java             | 4 ++--
 .../src/test/org/apache/solr/cloud/SolrCloudExampleTest.java     | 4 ++++
 3 files changed, 9 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/b4d8e42a/solr/CHANGES.txt
----------------------------------------------------------------------
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 10aa550..e38d19b 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -195,6 +195,9 @@ Bug Fixes
 
 * SOLR-9128: Fix error handling issues in Streaming classes (Joel Bernstein)
 
+* SOLR-8801: /bin/solr create script always returns exit code 0 when a collection/core already
exists.
+  (Khalid Alharbi, Marius Grama via Steve Rowe)
+
 Optimizations
 ----------------------
 * SOLR-8722: Don't force a full ZkStateReader refresh on every Overseer operation.

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/b4d8e42a/solr/core/src/java/org/apache/solr/util/SolrCLI.java
----------------------------------------------------------------------
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 55b9ff1..46532a1 100644
--- a/solr/core/src/java/org/apache/solr/util/SolrCLI.java
+++ b/solr/core/src/java/org/apache/solr/util/SolrCLI.java
@@ -1642,7 +1642,7 @@ public class SolrCLI {
       String systemInfoUrl = solrUrl+"admin/info/system";
       CloseableHttpClient httpClient = getHttpClient();
 
-      Tool tool = null;
+      ToolBase tool = null;
       try {
         Map<String, Object> systemInfo = getJson(httpClient, systemInfoUrl, 2, true);
         if ("solrcloud".equals(systemInfo.get("mode"))) {
@@ -1650,7 +1650,7 @@ public class SolrCLI {
         } else {
           tool = new CreateCoreTool(stdout);
         }
-        tool.runTool(cli);
+        tool.runImpl(cli);
       } finally {
         closeHttpClient(httpClient);
       }

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/b4d8e42a/solr/core/src/test/org/apache/solr/cloud/SolrCloudExampleTest.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/cloud/SolrCloudExampleTest.java b/solr/core/src/test/org/apache/solr/cloud/SolrCloudExampleTest.java
index f084c20..a844db3 100644
--- a/solr/core/src/test/org/apache/solr/cloud/SolrCloudExampleTest.java
+++ b/solr/core/src/test/org/apache/solr/cloud/SolrCloudExampleTest.java
@@ -93,6 +93,10 @@ public class SolrCloudExampleTest extends AbstractFullDistribZkTestBase
{
     ensureAllReplicasAreActive(testCollectionName, "shard2", 2, 2, 10);
     cloudClient.setDefaultCollection(testCollectionName);
 
+    int invalidToolExitStatus = 1;
+    assertEquals("Collection '" + testCollectionName + "' created even though it already
existed",
+        invalidToolExitStatus, tool.runTool(cli));
+
     // now index docs like bin/post would do but we can't use SimplePostTool because it uses
System.exit when
     // it encounters an error, which JUnit doesn't like ...
     log.info("Created collection, now posting example docs!");


Mime
View raw message