Solr
  1. Solr
  2. SOLR-6867

bin/solr -e foo should use collection/cores api to check if collection/core exists before trying to create it

    Details

    • Type: Improvement Improvement
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 5.0
    • Component/s: None
    • Labels:
      None

      Description

      currently if you run an example command and the core/collection being created already exists you get an error message in the console, ut then the example keeps working (see below).

      I think it would be better if the script used the cores api (or collection api in the 'cloud' example) to check if the collection already existed, and if so just output a note about it, something like...

      Core API indicates a core named 'techproducts' already exists...
      http://localhost:8983/solr/admin/cores?action=status&core=techproducts
      
      To remove this core, use the following command...
        bin/solr ...etc...
      And then you can recreate it with...
        bin/solr ...etc...
      

      Current behavior...

      ...
      Creating new core 'techproducts' using command:
      
      http://localhost:8983/solr/admin/cores?action=CREATE&name=techproducts&instanceDir=techproducts
      
      Exception in thread "main" org.apache.solr.client.solrj.SolrServerException: Request to http://localhost:8983/solr/admin/cores?action=CREATE&name=techproducts&instanceDir=techproducts failed due to: Core with name 'techproducts' already exists.
      	at org.apache.solr.util.SolrCLI.getJson(SolrCLI.java:473)
      	at org.apache.solr.util.SolrCLI.getJson(SolrCLI.java:416)
      	at org.apache.solr.util.SolrCLI.getJson(SolrCLI.java:402)
      	at org.apache.solr.util.SolrCLI$CreateCoreTool.runTool(SolrCLI.java:1274)
      	at org.apache.solr.util.SolrCLI.main(SolrCLI.java:185)
      Indexing tech product example docs from /home/hossman/lucene/5x_dev/solr/example/exampledocs
      SimplePostTool version 1.5
      Posting files to base url http://localhost:8983/solr/techproducts/update using content-type application/xml..
      ...
      

        Issue Links

          Activity

          Hide
          ASF subversion and git services added a comment -

          Commit 1647726 from Timothy Potter in branch 'dev/trunk'
          [ https://svn.apache.org/r1647726 ]

          SOLR-6867: SolrCLI should check for existence before creating a new core/collection, more user-friendly error reporting (no stack trace), and the ability to pass a directory when using bin/solr to create a core or collection

          Show
          ASF subversion and git services added a comment - Commit 1647726 from Timothy Potter in branch 'dev/trunk' [ https://svn.apache.org/r1647726 ] SOLR-6867 : SolrCLI should check for existence before creating a new core/collection, more user-friendly error reporting (no stack trace), and the ability to pass a directory when using bin/solr to create a core or collection
          Hide
          ASF subversion and git services added a comment -

          Commit 1647815 from Timothy Potter in branch 'dev/branches/branch_5x'
          [ https://svn.apache.org/r1647815 ]

          SOLR-6867: SolrCLI should check for existence before creating a new core/collection, more user-friendly error reporting (no stack trace), and the ability to pass a directory when using bin/solr to create a core or collection

          Show
          ASF subversion and git services added a comment - Commit 1647815 from Timothy Potter in branch 'dev/branches/branch_5x' [ https://svn.apache.org/r1647815 ] SOLR-6867 : SolrCLI should check for existence before creating a new core/collection, more user-friendly error reporting (no stack trace), and the ability to pass a directory when using bin/solr to create a core or collection

            People

            • Assignee:
              Timothy Potter
              Reporter:
              Hoss Man
            • Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development