Uploaded image for project: 'Solr'
  1. Solr
  2. SOLR-8677

SOLR allows creation of shards with invalid names.


    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 6.0
    • Fix Version/s: 6.0
    • Component/s: None
    • Labels:


      Solr currently has "recommendations" about what constitutes a valid identifier, but doesn't enforce these "recommendations" uniformly. Core (SOLR-8308) and collection (SOLR-8642) names are currently checked, but shards aren't.

      $ bin/solr -e cloud -noprompt
      $ curl -i -l -k -X GET "http://localhost:8983/solr/admin/collections?action=CREATE&name=coll1&router.name=implicit&numShards=1&shards=bad+shard+name"
      HTTP/1.1 200 OK
      Content-Type: application/xml; charset=UTF-8
      Transfer-Encoding: chunked
      <?xml version="1.0" encoding="UTF-8"?>
      <lst name="responseHeader"><int name="status">0</int><int name="QTime">204</int></lst><lst name="failure"><str>org.apache.solr.client.solrj.impl.HttpSolrClient$RemoteSolrException:Error from server at Error CREATEing SolrCore 'coll1_bad shard name_replica1': Unable to create core [coll1_bad shard name_replica1] Caused by: Invalid name: 'coll1_bad shard name_replica1' Identifiers must consist entirely of periods, underscores and alphanumerics</str></lst>

      (Note that the CREATE command above returned 200-OK, and the failure was only apparent when viewing the message.)

      A CLUSTERSTATUS shows that the shard was actually created, but has no underlying cores.

      $ curl -i -l -k -X GET "http://localhost:8983/solr/admin/collections?action=CLUSTERSTATUS&wt=json&indent=true"
              "shards":{"bad shard name":{

      This JIRA proposes adding a check to ensure that shard names meet SOLR's identifier "recommendations". This should prevent users from accidentally putting themselves in a bad state.


        1. SOLR-8677.patch
          34 kB
          Anshum Gupta
        2. SOLR-8677.patch
          31 kB
          Anshum Gupta
        3. SOLR-8677.patch
          28 kB
          Jason Gerlowski
        4. SOLR-8677.patch
          7 kB
          Jason Gerlowski
        5. SOLR-8677-5x-revert.patch
          34 kB
          Anshum Gupta

          Issue Links



              • Assignee:
                anshumg Anshum Gupta
                gerlowskija Jason Gerlowski
              • Votes:
                1 Vote for this issue
                6 Start watching this issue


                • Created: