You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Jason Gerlowski (JIRA)" <ji...@apache.org> on 2016/02/04 15:38:39 UTC

[jira] [Created] (SOLR-8642) SOLR allows creation of collections with invalid names

Jason Gerlowski created SOLR-8642:
-------------------------------------

             Summary: SOLR allows creation of collections with invalid names
                 Key: SOLR-8642
                 URL: https://issues.apache.org/jira/browse/SOLR-8642
             Project: Solr
          Issue Type: Bug
          Components: SolrCloud
    Affects Versions: Trunk
            Reporter: Jason Gerlowski
            Priority: Minor


Some of my colleagues and I recently noticed that the CREATECOLLECTION API will create a collection even when invalid characters are present in the name.

For example, consider the following reproduction case, which involves creating a collection with a space in its name:

{code}
$ <clean checkout of SOLR master/trunk>
$ bin/solr start -e cloud -noprompt
    ...
$ curl -i -l -k -X GET "http://localhost:8983/solr/admin/collections?action=CREATE&name=getting+started&numShards=2&replicationFactor=2&maxShardsPerNode=2&collection.configName=gettingstarted"
HTTP/1.1 200 OK
Content-Type: application/xml; charset=UTF-8
Transfer-Encoding: chunked

<?xml version="1.0" encoding="UTF-8"?>
<response>
<lst name="responseHeader"><int name="status">0</int><int name="QTime">299</int></lst><lst name="failure"><str>org.apache.solr.client.solrj.impl.HttpSolrClient$RemoteSolrException:Error from server at http://127.0.1.1:8983/solr: Error CREATEing SolrCore 'getting started_shard2_replica2': Unable to create core [getting started_shard2_replica2] Caused by: Invalid core name: 'getting started_shard2_replica2' Names must consist entirely of periods, underscores and alphanumerics</str><str>org.apache.solr.client.solrj.impl.HttpSolrClient$RemoteSolrException:Error from server at http://127.0.1.1:7574/solr: Error CREATEing SolrCore 'getting started_shard2_replica1': Unable to create core [getting started_shard2_replica1] Caused by: Invalid core name: 'getting started_shard2_replica1' Names must consist entirely of periods, underscores and alphanumerics</str><str>org.apache.solr.client.solrj.impl.HttpSolrClient$RemoteSolrException:Error from server at http://127.0.1.1:7574/solr: Error CREATEing SolrCore 'getting started_shard1_replica1': Unable to create core [getting started_shard1_replica1] Caused by: Invalid core name: 'getting started_shard1_replica1' Names must consist entirely of periods, underscores and alphanumerics</str><str>org.apache.solr.client.solrj.impl.HttpSolrClient$RemoteSolrException:Error from server at http://127.0.1.1:8983/solr: Error CREATEing SolrCore 'getting started_shard1_replica2': Unable to create core [getting started_shard1_replica2] Caused by: Invalid core name: 'getting started_shard1_replica2' Names must consist entirely of periods, underscores and alphanumerics</str></lst>
</response>
$ 
$ curl -i -l -k -X GET "http://localhost:8983/solr/admin/collections?action=CLUSTERSTATUS&wt=json&indent=true"
HTTP/1.1 200 OK
Content-Type: application/json; charset=UTF-8
Transfer-Encoding: chunked

{
  "responseHeader":{
    "status":0,
    "QTime":6},
  "cluster":{
    "collections":{
     ...
      "getting started":{
        "replicationFactor":"2",
        "shards":{
          "shard1":{
            "range":"80000000-ffffffff",
            "state":"active",
            "replicas":{}},
          "shard2":{
            "range":"0-7fffffff",
            "state":"active",
            "replicas":{}}},
        "router":{"name":"compositeId"},
        "maxShardsPerNode":"2",
        "autoAddReplicas":"false",
        "znodeVersion":1,
        "configName":"gettingstarted"},
    "live_nodes":["127.0.1.1:8983_solr",
      "127.0.1.1:7574_solr"]}}
{code}

The commands/responses above suggest that Solr creates the collection without checking the name.  It then goes on to create the cores for the collection, which fails are returns an error.

I verified this by doing a {{curl -i -l -k "http://localhost:8983/solr/admin/cores}}; as expected the cores were not actually created.  (This is probably thanks to Erick's work on SOLR-8308).

This bug is a problem because it will create collections which can never be backed up with actual cores.

Seems like the same name-verification that 8308 added to cores should also be applied to collections.



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

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