Commit Graph

5956 Commits

Author SHA1 Message Date
Lee Hinman 5849c488b5 Merge remote-tracking branch 'dakrone/compliation-breaker' 2016-08-09 11:57:26 -06:00
Clinton Gormley eac14f6e3d Bumped version to 5.0.0-alpha6 and added bwc indices for alpha5 2016-08-09 18:31:27 +02:00
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
Yannick Welsch 6abcd42a05 Simplify RoutingNodes interface (#19870)
Slims the public interface of RoutingNodes down to 4 methods to update routing entries:
- initializeShard() -> initializes an unassigned shard
- startShard() -> starts an initializing shard / completes relocation of a shard
- relocateShard() -> starts relocation of a started shard
- failShard() -> fails/cancels an assigned shard

In the spirit of PR #19743, where deassociateDeadNodes was moved to its own public method to be only called when nodes have actually left the cluster and not on every reroute step, this commit also removes electPrimariesAndUnassignedDanglingReplicas from AllocationService and folds it into the shard failure logic. This means that an active replica is promoted to primary in the same method where the primary was failed. Previously we would scan in each reroute iteration for active replicas to be promoted to primary.
2016-08-09 17:07:13 +02:00
Luca Cavanna af5fbcddfc Merge pull request #19871 from javanna/fix/short_query_multiple_fields
Throw exception when multiple field names are provided as part of query short syntax
2016-08-09 11:15:36 +02:00
Adrien Grand c44679d952 Save one utf8 conversion in KeywordFieldMapper. #19867
If a `keyword` field is both indexed and doc-valued, then we will convert the
input string to utf8 bytes twice: once for indexing/storing, and once for doc
values. This commit changes `keyword` fields to compute the utf8 representation
up-front and then feed both the inverted index and doc values with it.

Rather than adding version-based bw compat logic, I broke the `keyword` field
(they are now indexed/stored as a binary field rather than string), which is
fine since we are still on alpha releases for 5.0.
2016-08-09 10:06:30 +02:00
javanna f9a40344b2 Modify term query error when multiple fields are provided to comply with all other queries 2016-08-09 10:01:56 +02:00
javanna 0f54cb69ab Throw parsing error if span term query contains multiple fields in its short version 2016-08-09 09:53:03 +02:00
javanna d4db987825 Add common method that throws exception whenever multiple fields are provided in a query that support one field only
This makes sure that error messages are unified, and makes us save a few lines of code too.
2016-08-09 09:52:28 +02:00
javanna bbf40ca0cf [TEST] test that term query short syntax throws error when multiple fields are provided 2016-08-09 09:50:12 +02:00
Jason Tedor 1aba907ea2 Remove dead OOM handling in engine
Previously, the engine would catch an out of memory error and would try
to handle the error (it would try to fail the engine, and then it would
swallow the out of memory error). Catching the out of memory errors was
removed in 3343ceeae4 so this code path is
not effectively dead. This commit removes this dead code from the
engine.

Relates #19881
2016-08-08 21:59:49 -04:00
javanna f547886a9b [TEST] remove AwaitsFix that was fixed with #16615 2016-08-08 20:39:55 +02:00
javanna 9beb82b036 [TEST] remove unused argument from GeoPolygonQueryBuilderTests#randomPolygon 2016-08-08 20:39:55 +02:00
javanna 27a6983646 Throw parsing error if wildcard query contains multiple fields in its short version 2016-08-08 19:42:48 +02:00
javanna 796bc74163 Throw parsing error if regexp query contains multiple fields in its short version 2016-08-08 19:42:37 +02:00
javanna 8f485b3614 Throw parsing error if prefix query contains multiple fields in its short version 2016-08-08 19:42:26 +02:00
javanna 040f9c6be6 Throw parsing error if match query contains multiple fields in its short version 2016-08-08 19:42:14 +02:00
javanna d5316b2783 Throw parsing error if match phrase query contains multiple fields in its short version 2016-08-08 19:42:01 +02:00
javanna cb41f304f2 Throw parsing error if match phrase prefix query contains multiple fields in its short version 2016-08-08 19:41:45 +02:00
javanna 5d238e86f6 Throw parsing error if fuzzy query contains multiple fields in its short version 2016-08-08 19:40:54 +02:00
javanna 1db3c67e31 Throw parsing error if common terms query contains multiple fields in its short version 2016-08-08 19:40:23 +02:00
Colin Goodheart-Smithe bf0e42aaeb #19855 Throw exception when maxBounds greater than minBounds
Throw exception when maxBounds greater than minBounds
2016-08-08 13:17:25 +01:00
Colin Goodheart-Smithe 4735e0a9d3 Throw exception when maxBounds greater than minBounds
The recent changes to the Histogram Aggregator introduced a bug where
an exception would not be thrown if the maxBound of the extended bounds
is less that the minBound. This change fixes that bug.

Closes #19833
2016-08-08 12:09:43 +01:00
Yannick Welsch 180eff14dd Fix issue when relocation source and target routings are failed in same batch update
PR #19715 made AllocationService less lenient, requiring ShardRouting instances that are passed to its applyStartedShards and
applyFailedShards methods to exist in the routing table. As primary shard failures also fail initializing replica shards,
concurrent replica shard failures that are treated in the same cluster state update might not reference existing replica entries
in the routing table anymore. To solve this, PR #19715 ordered the failures by first handling replica before
primary failures. There are other failures that influence more than one routing entry, however. When we have a failed shard entry
for both a relocation source and target, then, depending on the order, either one or the other might point to an out-dated shard
entry. As finding a good order is more difficult than applying the failures, this commit re-adds parts of the ShardRouting
re-resolve logic so that the applyFailedShards method can properly treat shard failure batches.
2016-08-08 11:46:48 +02:00
Nicholas Knize ab0a0cd4d4 fix rogue license header 2016-08-05 23:21:16 -05:00
Nicholas Knize 2d590af593 Deprecate GeoDistance enumerators and remove geo distance script helpers
GeoDistance is implemented using a crazy enum that causes issues with the scripting modules. This commit moves all distance calculations to arcDistance and planeDistance static methods in GeoUtils. It also removes unnecessary distance helper methods from ScriptDocValues.GeoPoints.
2016-08-05 18:42:06 -05:00
Areek Zillur 469eb2546d Merge pull request #19536 from areek/enhancement/completion_suggester_documents
Add support for returning documents with completion suggester
2016-08-05 18:55:08 -04:00
Areek Zillur fee013c07c Add support for returning documents with completion suggester
This commit enables completion suggester to return documents
associated with suggestions. Now the document source is returned
with every suggestion, which respects source filtering options.

In case of suggest queries spanning more than one shard, the
suggest is executed in two phases, where the last phase fetches
the relevant documents from shards, implying executing suggest
requests against a single shard is more performant due to the
document fetch overhead when the suggest spans multiple shards.
2016-08-05 17:51:45 -04:00
Christoph Büscher fbbb633d81 Merge pull request #19825 from cbuescher/register-namedWritables-transportClient
Add NamedWriteables from plugins to TransportClient
2016-08-05 22:51:04 +02:00
Christoph Büscher 6ccb70e1ab Avoid using injector and more test to TransportClientTests 2016-08-05 21:39:44 +02:00
Christoph Büscher 37c433aace Merge pull request #19837
Ensure PutMappingRequest.buildFromSimplifiedDef input are pairs
2016-08-05 20:31:49 +02:00
Christoph Büscher e57f76aa2d Ensure PutMappingRequest.buildFromSimplifiedDef fails when input isn't pairs
The method requires pairs of fieldnames and property arguments and will fail if
the varargs input is an uneven number. We should check this and fail with an
appropriate IllegalArgumentException instead.
2016-08-05 19:25:20 +02:00
Britta Weber 981478e4a9 mute test 2016-08-05 19:10:13 +02:00
Britta Weber 899cddefb6 make ctors protected (#19831)
This is useful if we need an acknowledged instance in a test
2016-08-05 17:13:26 +02:00
Nik Everett 8bebf2599e Add note explaining analysis caching for plugins
```
Elasticsearch doesn't have any automatic mechanism to share these
components between indexes. If any component is heavy enough to
warrant such sharing then it is the Pugin's responsibility to do
it in their {@link AnalysisProvider} implementation. We recommend
against doing this unless absolutely necessary because it can be
difficult to get the caching right given things like behavior
changes across versions.
```

Closes #19814
2016-08-05 11:11:53 -04:00
Christoph Büscher e162935656 Add test to check that plugin NamedWriteables are registerd with TransportClient 2016-08-05 17:08:59 +02:00
Luca Cavanna 4c1a3b9a53 Merge pull request #19791 from javanna/fix/multiple_fields_queries
Query parsers to throw exception when multiple field names are provided
2016-08-05 15:53:35 +02:00
Ali Beyad f59ca9083b Snapshot repository cleans up empty index folders (#19751)
This commit cleans up indices in a snapshot repository when all
snapshots containing the index are all deleted. Previously, empty
indices folders would lay around after all snapshots containing
them were deleted.
2016-08-05 09:39:02 -04:00
Adrien Grand 284b9794c0 Do not parse the created version from the settings every time a field is parsed. #19824
I found it while looking at some jfr telemetry reports from Rally.
2016-08-05 15:35:53 +02:00
Christoph Büscher c32a4324b0 Add NamedWriteables from plugins to TransportClient
Plugins provide NamedWriteables that are added to the
NamedWriteableRegistry. Those are added on Nodes already, the same mechanism is
added to the setup for TransportClient.
2016-08-05 14:11:01 +02:00
javanna 7f0bd56094 [TEST] use expectThrows wherever possible in query builder unit tests 2016-08-05 13:55:18 +02:00
Tanguy Leroux 841d5a210e Update to Jackson 2.8.1
This commit updates Jackson to the 2.8.1 version, which is more strict when it comes to build objects. It also adds the snakeyaml dependency that was previously shaded in jackson libs.

It also closes #18076
2016-08-05 12:26:06 +02:00
javanna 6a5c44a271 fix line length in FuzzyQueryBuilder 2016-08-05 10:58:19 +02:00
javanna 0ac7dd6137 Make query parsing stricter by requiring each parser to stop at END_OBJECT token
Instead of being lenient in QueryParseContext#parseInnerQueryBuilder we check that the token where the parser stopped reading was END_OBJECT, and throw error otherwise. This is a best effort to verify that the parsers read a whole object rather than stepping out in the middle of it due to malformed queries.
2016-08-05 10:58:19 +02:00
javanna 43fee1d7fa Throw parsing error if fuzzy query contains multiple fields
Fuzzy Query, like many other queries, used to parse even when the query referred to multiple fields and the first one would win. We rather throw an exception now instead.
Also added test for short prefix query variant and modified the parsing code to consume the whole query object.
2016-08-05 10:58:19 +02:00
javanna 6d228bb09c [TEST] test that term query throws error when made against multiple fields 2016-08-05 10:58:19 +02:00
javanna 389bd06846 [TEST] check validation error messages in AbstractTermQueryTestCase 2016-08-05 10:58:19 +02:00
javanna 1bcf0722c4 Throw parsing error if span_term query contains multiple fields
Span term Query, like many other queries, used to parse even when the query referred to multiple fields and the first one would win. We rather throw an exception now instead.
Also modified the parsing code to consume the whole query object.
2016-08-05 10:58:19 +02:00
javanna c3dfe0846c Throw parsing error if common terms query contains multiple fields
Common Terms Query, like many other queries, used to parse even when the query referred to multiple fields and the first one would win. We rather throw an exception now instead.
Also added test for short prefix query variant and modified the parsing code to consume the whole query object.
2016-08-05 10:58:19 +02:00
javanna 1e45fd5850 Throw parsing error if match query contains multiple fields
Match Query, like many other queries, used to parse even when the query referred to multiple fields and the first one would win. We rather throw an exception now instead.
Also added test for short prefix query variant and modified the parsing code to consume the whole query object.
2016-08-05 10:58:19 +02:00