Skip to content

SQL query error occurred during the rolling upgrade from 7.5 to 7.10. #78301

@conicliu

Description

@conicliu

Elasticsearch version (bin/elasticsearch --version): 7.5.1 7.10.1

Plugins installed: [] None

JVM version (java -version): java version "12" 2019-03-19

OS version (uname -a if on a Unix-like system): Darwin Kernel Version 19.6.0

Description of the problem including expected versus actual behavior:
During the rolling upgrade from 7.5.1 to 7.10.1, all existing queries should be successfully executed.

But exception occurred:

Steps to reproduce:

Please include a minimal but complete recreation of the problem,
including (e.g.) index creation, mappings, settings, query etc. The easier
you make for us to reproduce it, the more likely that somebody will take the
time to look at it.

  1. create 7.5.1 cluster, node number >= 2
  2. create index: number_of_shards must greater than 1,with a field store timestamp as long type
PUT test_sql_query
{
   "settings" : {
      "number_of_shards" : 10,
      "number_of_replicas" : 0
   },
   "mappings":{
       "properties" : {
            "__timestamp__":{
                "type": "long"
            },
            "event":{
                "type" : "long"
            }
       }
   }
}
  1. index some data
POST  _bulk 
{"index":{"_index":"test_sql_query"}}
{"__timestamp__":"1632723340", "event":"1"}
{"index":{"_index":"test_sql_query"}}
{"__timestamp__":"1632723330", "event":"2"}
{"index":{"_index":"test_sql_query"}}
{"__timestamp__":"1632722330", "event":"2"}
'
  1. Perform a rolling upgrade. When some nodes are 7.5.1 and some nodes are 7.10.1, following query request is executed:
# send request to 7.5.1 node
GET /_sql
{
"query":"SELECT HISTOGRAM(CAST(__timestamp__ AS TIMESTAMP), INTERVAL 1 MINUTE) AS time, count(DISTINCT (event)) AS events FROM test_sql_query GROUP BY time ORDER BY time "
}

# get the error:
{
  "error" : {
    "root_cause" : [
      {
        "type" : "script_exception",
        "reason" : "compile error",
        "script_stack" : [
          "... st(InternalSqlScriptUtils.docValue(doc,params.v0), ...",
          "                             ^---- HERE"
        ],
        "script" : "InternalSqlScriptUtils.cast(InternalSqlScriptUtils.docValue(doc,params.v0),params.v1)",
        "lang" : "painless"
      }
    ],
    "type" : "search_phase_execution_exception",
    "reason" : "Partial shards failure",
    "phase" : "query",
    "grouped" : true,
    "failed_shards" : [
      {
        "shard" : 2,
        "index" : "test_sql_query",
        "node" : "XRdI1ELjStaaMMPEjHhg0A",
        "reason" : {
          "type" : "script_exception",
          "reason" : "compile error",
          "script_stack" : [
            "... st(InternalSqlScriptUtils.docValue(doc,params.v0), ...",
            "                             ^---- HERE"
          ],
          "script" : "InternalSqlScriptUtils.cast(InternalSqlScriptUtils.docValue(doc,params.v0),params.v1)",
          "lang" : "painless",
          "caused_by" : {
            "type" : "illegal_argument_exception",
            "reason" : "static method [org.elasticsearch.xpack.sql.expression.function.scalar.whitelist.InternalSqlScriptUtils, docValue/2] not found"
          }
        }
      }
    ]
  },
  "status" : 400
}

# send request to 7.10.1 node, then get the error:
{
  "error" : {
    "root_cause" : [
      {
        "type" : "script_exception",
        "reason" : "compile error",
        "script_stack" : [
          "... ernalSqlScriptUtils.cast(InternalQlScriptUtils.doc ...",
          "                             ^---- HERE"
        ],
        "script" : "InternalSqlScriptUtils.cast(InternalQlScriptUtils.docValue(doc,params.v0),params.v1)",
        "lang" : "painless"
      }
    ],
    "type" : "search_phase_execution_exception",
    "reason" : "Partial shards failure",
    "phase" : "query",
    "grouped" : true,
    "failed_shards" : [
      {
        "shard" : 0,
        "index" : "test_sql_query",
        "node" : "olrpxVgOQ3ioZAYvn5ZHqw",
        "reason" : {
          "type" : "script_exception",
          "reason" : "compile error",
          "script_stack" : [
            "... ernalSqlScriptUtils.cast(InternalQlScriptUtils.doc ...",
            "                             ^---- HERE"
          ],
          "script" : "InternalSqlScriptUtils.cast(InternalQlScriptUtils.docValue(doc,params.v0),params.v1)",
          "lang" : "painless",
          "caused_by" : {
            "type" : "illegal_argument_exception",
            "reason" : "Variable [InternalQlScriptUtils] is not defined."
          }
        }
      }
    ]
  },
  "status" : 400
}

Provide logs (if relevant):
(No logs are generated in the background)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions