You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by sa...@apache.org on 2016/05/20 23:40:14 UTC

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

Repository: lucene-solr
Updated Branches:
  refs/heads/branch_6_0 5c8594042 -> 02a5e1521


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/02a5e152
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/02a5e152
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/02a5e152

Branch: refs/heads/branch_6_0
Commit: 02a5e15212429ed25e0a52744195a6406b37c8ab
Parents: 5c85940
Author: Steve Rowe <sa...@apache.org>
Authored: Fri May 20 19:36:39 2016 -0400
Committer: Steve Rowe <sa...@apache.org>
Committed: Fri May 20 19:40:01 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/02a5e152/solr/CHANGES.txt
----------------------------------------------------------------------
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 6a41d3f..19f473c 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -84,6 +84,9 @@ Bug Fixes
 * SOLR-9116: Race condition causing occasional SolrIndexSearcher leak when SolrCore is reloaded.
   (Jessica Cheng Mallet via shalin)
 
+* SOLR-8801: /bin/solr create script always returns exit code 0 when a collection/core already exists.
+  (Khalid Alharbi, Marius Grama via Steve Rowe)
+
 Other Changes
 ----------------------
 * SOLR-7516: Improve javadocs for JavaBinCodec, ObjectResolver and enforce the single-usage policy.

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/02a5e152/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 f498a82..6d5aa8f 100644
--- a/solr/core/src/java/org/apache/solr/util/SolrCLI.java
+++ b/solr/core/src/java/org/apache/solr/util/SolrCLI.java
@@ -1640,7 +1640,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"))) {
@@ -1648,7 +1648,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/02a5e152/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!");