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

Jason Gerlowski commented on SOLR-5970:
---------------------------------------

Attached a patch which takes a stab at this.  With this change, the badconf 
reproductions Ishan outlines above returns the following response:

{code}
{
  "responseHeader":{
    "status":400,
    "QTime":2816},
  "failure":{
    
"192.168.1.194:8983_solr":"org.apache.solr.client.solrj.impl.HttpSolrClient$RemoteSolrException:Error
 from server at http://192.168.1.194:8983/solr: Error CREATEing SolrCore 
'D827ACAB-8C4A-4C67-80B7-3DA93066FD6D_shard1_replica_n1': Unable to create core 
[D827ACAB-8C4A-4C67-80B7-3DA93066FD6D_shard1_replica_n1] Caused by: 
solr.ThrowErrorOnInitRequestHandler"},
  "Operation create caused 
exception:":"org.apache.solr.common.SolrException:org.apache.solr.common.SolrException:
 Underlying core creation failed while creating collection: foo",
  "exception":{
    "msg":"Underlying core creation failed while creating collection: foo",
    "rspCode":400},
  "error":{
    "metadata":[
      "error-class","org.apache.solr.common.SolrException",
      "root-error-class","org.apache.solr.common.SolrException"],
    "msg":"Underlying core creation failed while creating collection: foo",
    "code":400}}
{code}

*Miscellaneous Notes on the Patch*
* SolrJ code that encounters similar collection-creation error conditions will 
see a {{RemoteSolrException}} be thrown.  This is standard in SolrJ, just 
mentioning it.
* existing tests pass, but I'd like to add a more explicit test for this case 
(or adopt the one attached here already)
* The patch here only addresses this behavior for the create-collection API.  I 
could've made a broader change that affected other collection-admin APIs, but 
didn't want to exceed the original intent here.
* Would love to get some feedback on the new response.  Otherwise though I'll 
commit in a few days.

As a side note, I hadn't paid attention to the collection-admin responses in a 
while, and they were worse than I remembered.  We have 4(!) different things 
that readers might look at to check for problems: (1) the integer property 
"status", (2) a top level "failure" property, (3) a top level "exception" 
property, (4) a top level "error" property.  Yikes.  Def worth some further 
attention and (maybe drastic) change.  I'd be interested in helping where I can 
if anyone else gets involved here.

> Create collection API always has status 0
> -----------------------------------------
>
>                 Key: SOLR-5970
>                 URL: https://issues.apache.org/jira/browse/SOLR-5970
>             Project: Solr
>          Issue Type: Bug
>            Reporter: Abraham Elmahrek
>            Assignee: Jason Gerlowski
>            Priority: Major
>         Attachments: SOLR-5970-test.patch, SOLR-5970.patch, bad.jar, 
> schema.xml, solrconfig.xml
>
>
> The responses below are from a successful create collection API 
> (https://cwiki.apache.org/confluence/display/solr/Collections+API#CollectionsAPI-CreateormodifyanAliasforaCollection)
>  call and an unsuccessful create collection API call. It seems the 'status' 
> is always 0.
> Success:
> {u'responseHeader': {u'status': 0, u'QTime': 4421}, u'success': {u'': 
> {u'core': u'test1_shard1_replica1', u'responseHeader': {u'status': 0, 
> u'QTime': 3449}}}}
> Failure:
> {u'failure': 
>   {u'': 
> u"org.apache.solr.client.solrj.impl.HttpSolrServer$RemoteSolrException:Error 
> CREATEing SolrCore 'test43_shard1_replica1': Unable to create core: 
> test43_shard1_replica1 Caused by: Could not find configName for collection 
> test43 found:[test1]"},
>  u'responseHeader': {u'status': 0, u'QTime': 17149}
> }
> It seems like the status should be 400 or something similar for an 
> unsuccessful attempt?



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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

Reply via email to