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

V2 Core-Rename API fails to parse new core name

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 7.1, 8.0
    • 7.2, 8.0
    • v2 API
    • None

    Description

      I noticed recently that the v2 Solr API's rename-core command fails to parse out the provided "to" parameter (which contains the desired new core name).

      _introspect shows the following documentation for the API:

              "rename":{
                "type":"object",
                "documentation":"https://lucene.apache.org/solr/guide/coreadmin-api.html#coreadmin-rename",
                "description":"Change the name of a core.",
                "properties":{
                  "to":{
                    "type":"string",
                    "description":"The new name for the core."},
                  "async":{
                    "type":"string",
                    "description":"Defines a request ID that can be used to track this action after it's submitted. The action will be processed asynchronously when this is defined."}},
                "required":["to"]},
      

      but it appears that the underlying code fails to parse out the "to" parameter:

      ➜  solr git:(master) ✗ curl -ilk -X POST "$SOLR_HOST/api/cores/foo" -d '{"rename": {"to":"bar"}}'
      HTTP/1.1 400 Bad Request
      Content-Type: application/json;charset=utf-8
      Content-Length: 381
      
      {
        "responseHeader":{
          "status":400,
          "QTime":0},
        "error":{
          "metadata":[
            "error-class","org.apache.solr.common.SolrException",
            "root-error-class","org.apache.solr.common.SolrException"],
          "msg":"Invalid core: [null]. core names must consist entirely of periods, underscores, hyphens, and alphanumerics as well not start with a hyphen",
          "code":400}}
      

      I'm not super familiar with the V2<->V1 API mapping code, but it looks like the underlying implementation in CoreAdminOperation is expecting a parameter named "other", but there's no mapping from "to" -> "other" for this particular API.

      Attachments

        1. repro.sh
          0.3 kB
          Jason Gerlowski
        2. SOLR-11608.patch
          1 kB
          Jason Gerlowski
        3. SOLR-11608.patch
          2 kB
          Jason Gerlowski

        Activity

          People

            anshum Anshum Gupta
            gerlowskija Jason Gerlowski
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: