OpenSearch/qa
Lee Hinman 2be52eff09 Circuit break the number of inline scripts compiled per minute
When compiling many dynamically changing scripts, parameterized
scripts (<https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-scripting-using.html#prefer-params>)
should be preferred. This enforces a limit to the number of scripts that
can be compiled within a minute. A new dynamic setting is added -
`script.max_compilations_per_minute`, which defaults to 15.

If more dynamic scripts are sent, a user will get the following
exception:

```json
{
  "error" : {
    "root_cause" : [
      {
        "type" : "circuit_breaking_exception",
        "reason" : "[script] Too many dynamic script compilations within one minute, max: [15/min]; please use on-disk, indexed, or scripts with parameters instead",
        "bytes_wanted" : 0,
        "bytes_limit" : 0
      }
    ],
    "type" : "search_phase_execution_exception",
    "reason" : "all shards failed",
    "phase" : "query",
    "grouped" : true,
    "failed_shards" : [
      {
        "shard" : 0,
        "index" : "i",
        "node" : "a5V1eXcZRYiIk8lecjZ4Jw",
        "reason" : {
          "type" : "general_script_exception",
          "reason" : "Failed to compile inline script [\"aaaaaaaaaaaaaaaa\"] using lang [painless]",
          "caused_by" : {
            "type" : "circuit_breaking_exception",
            "reason" : "[script] Too many dynamic script compilations within one minute, max: [15/min]; please use on-disk, indexed, or scripts with parameters instead",
            "bytes_wanted" : 0,
            "bytes_limit" : 0
          }
        }
      }
    ],
    "caused_by" : {
      "type" : "general_script_exception",
      "reason" : "Failed to compile inline script [\"aaaaaaaaaaaaaaaa\"] using lang [painless]",
      "caused_by" : {
        "type" : "circuit_breaking_exception",
        "reason" : "[script] Too many dynamic script compilations within one minute, max: [15/min]; please use on-disk, indexed, or scripts with parameters instead",
        "bytes_wanted" : 0,
        "bytes_limit" : 0
      }
    }
  },
  "status" : 500
}
```

This also fixes a bug in `ScriptService` where requests being executed
concurrently on a single node could cause a script to be compiled
multiple times (many in the case of a powerful node with many shards)
due to no synchronization between checking the cache and compiling the
script. There is now synchronization so that a script being compiled
will only be compiled once regardless of the number of concurrent
searches on a node.

Relates to #19396
2016-08-09 10:26:27 -06:00
..
backwards-5.0 Rename client yaml test infrastructure 2016-07-26 13:53:44 -04:00
evil-tests Remove `node.mode` and `node.local` settings (#19428) 2016-07-14 13:21:10 +02:00
smoke-test-client Introduce Netty 4 2016-07-22 22:26:35 -04:00
smoke-test-http Introduce Netty 4 2016-07-22 22:26:35 -04:00
smoke-test-ingest-disabled ingest: Made the response format of the get pipeline api match with the response format of the index template api 2016-07-29 17:58:30 +02:00
smoke-test-ingest-with-all-dependencies ingest: Change the `foreach` processor to use the `_ingest._value` ingest metadata attribute to store the current array element being processed. 2016-07-27 09:35:09 +02:00
smoke-test-multinode Rename client yaml test infrastructure 2016-07-26 13:53:44 -04:00
smoke-test-plugins Rename client yaml test infrastructure 2016-07-26 13:53:44 -04:00
smoke-test-reindex-with-painless Circuit break the number of inline scripts compiled per minute 2016-08-09 10:26:27 -06:00
vagrant Vagrant tests should use plugin zips 2016-07-21 10:02:51 -04:00