[ 
https://issues.apache.org/jira/browse/SOLR-8801?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15184829#comment-15184829
 ] 

Marius Grama edited comment on SOLR-8801 at 3/8/16 12:03 PM:
-------------------------------------------------------------

Patch attached to this issue.

Due to the fact that SolrCLI.CreateTool was delegating the job  of creating the 
collection/core via {{SolrCLI.ToolBase#runTool(CommandLine)}} to the 
coresponding tool (CreateCollectionTool/CreateCoreTool), the exit code of the 
operation was being lost.

Calling instead  {{SolrCLI.ToolBase#runImpl(CommandLine)}} will generate an 
exception which will be caught in {{SolrCLI.ToolBase#runTool(CommandLine)}} and 
so, the invalid exit code status will be correctly returned when exiting from 
SolrCLI, while the functionality previously provided is still kept.

Via SolrCloudExampleTest.java I've added new instructions to be used for 
verifying that a collection can't be created again, once that it exists. 
Unfortunately, the test case is annotated with @LuceneTestCase.BadApple reason 
why it won't be taken into account by the tests.



was (Author: mariusneo):
Patch attached to this issue.

Due to the fact that SolrCLI.CreateTool was delegating the job  of creating the 
collection/core via {{SolrCLI.ToolBase#runTool(CommandLine)}} to the 
coresponding tool (CreateCollectionTool/CreateCoreTool), the exit code of the 
operation was being lost.

Calling instead  {{SolrCLI.ToolBase#runImpl(CommandLine)}} will generate an 
exception which will be caught in {{SolrCLI.ToolBase#runTool(CommandLine)}} and 
so, the invalid exit code status will be correctly returned when exiting from 
SolrCLI.

Via SolrCloudExampleTest.java I've added new instructions to be used for 
verifying that a collection can't be created again, once that it exists. 
Unfortunately, the test case is annotated with @LuceneTestCase.BadApple reason 
why it won't be taken into account by the tests.


> /bin/solr create script always returns exit code 0 
> ---------------------------------------------------
>
>                 Key: SOLR-8801
>                 URL: https://issues.apache.org/jira/browse/SOLR-8801
>             Project: Solr
>          Issue Type: Bug
>          Components: scripts and tools, SolrCloud
>    Affects Versions: 5.4, 5.5
>            Reporter: Khalid Alharbi
>            Priority: Minor
>             Fix For: 5.1
>
>         Attachments: SOLR_8801.patch
>
>   Original Estimate: 1m
>  Remaining Estimate: 1m
>
> /bin/solr create collection script always returns exit code 0 when a 
> collection already exists (solrCloud mode).
> version 5.1 returns exit code 1 but I just noticed that versions 5.4.0 and 
> 5.5.0 returns 0
>  
> >$ solr create -c my-collection -p 8983
> Connecting to ZooKeeper at localhost:9983 ...
> Re-using existing configuration directory my-collection
> ERROR: 
> Collection 'my-collection' already exists!
> Checked collection existence using Collections API command:
> http://localhost:8983/solr/admin/collections?action=list
> >$ echo $?
> 0



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org

Reply via email to