Commit Graph

23718 Commits

Author SHA1 Message Date
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
javanna f7b3dce4bc Throw parsing error if match_phrase_prefix query contains multiple fields
Match phrase prefix 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 ad8f5e7e4b Throw parsing error if geo_distance query contains multiple fields
Geo distance Query, like many other queries, used to parse even when the query referred to multiple fields and the last one would win. We rather throw an exception now instead.
2016-08-05 10:58:19 +02:00
javanna 195320f2d6 [TEST] check validation error messages in IdsQueryBuilderTests 2016-08-05 10:58:19 +02:00
javanna f56333048a Throw parsing error if match_phrase query contains multiple fields
Match phrase 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 51ea913248 Throw parsing error if wildcard query contains multiple fields
Wildcard 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 003a7b6eb3 Throw parsing error if regexp query contains multiple fields
Regexp Query, like many other queries, used to parse even when the query referred to multiple fields and the last one would win. We rather throw an exception now instead.
Also added test for short prefix query variant.
2016-08-05 10:58:19 +02:00
javanna 69c2deedc7 Throw parsing error if prefix query contains multiple fields
Prefix Query, like many other queries, used to parse when the query refers to multiple fields and the last one would win. We rather throw an exception now instead.
Also added tests for short prefix quer variant.
2016-08-05 10:58:19 +02:00
javanna 11e4b0168b Throw parsing error if range query contains multiple fields
Range Query, like many other queries, used to parse when the query refers to multiple fields and the last one would win. We rather throw an exception now instead.

Closes #19547
2016-08-05 10:58:19 +02:00
Colin Goodheart-Smithe a01475a20b #19781 Refactored Rounding simplify Date Histogram code
Refactored Rounding simplify Date Histogram code
2016-08-05 09:28:38 +01:00
Boaz Leskes 609a199bd4 Upon being elected as master, prefer joins' node info to existing cluster state (#19743)
When we introduces [persistent node ids](https://github.com/elastic/elasticsearch/pull/19140) we were concerned that people may copy data folders from one to another resulting in two nodes competing for the same id in the cluster. To solve this we elected to not allow an incoming join if a different with same id already exists in the cluster, or if some other node already has the same transport address as the incoming join. The rationeel there was that it is better to prefer existing nodes and that we can rely on node fault detection to remove any node from the cluster that isn't correct any more, making room for the node that wants to join (and will keep trying).

Sadly there were two problems with this:
1) One minor and easy to fix - we didn't allow for the case where the existing node can have the same network address as the incoming one, but have a different ephemeral id (after node restart). This confused the logic in `AllocationService`, in this rare cases. The cluster is good enough to detect this and recover later on, but it's not clean.
2) The assumption that Node Fault Detection will clean up is *wrong* when the node just won an election (it wasn't master before) and needs to process the incoming joins in order to commit the cluster state and assume it's mastership. In those cases, the Node Fault Detection isn't active. 

This PR fixes these two and prefers incoming nodes to existing node when finishing an election. 
On top of the, on request by @ywelsch , `AllocationService` synchronization between the nodes of the cluster and it's routing table is now explicit rather than something we do all the time. The same goes for promotion of replicas to primaries.
2016-08-05 08:58:03 +02:00
Jason Tedor 3f6a3c01da Merge pull request #19803 from elastic/fix/transportClientTests
Fix PreBuiltTransportClientTests to run and pass
2016-08-04 16:55:08 -04:00
Simon Willnauer e08f11dabc Remove BWC serialization logic for pre 2.2 nodes (#19810)
This change removes all pre 2.2 logic from InternalSearchResponse serialization. It's unneeded in 5.0 since we require full cluster restart
2016-08-04 22:47:39 +02:00
Nik Everett 1e587406d8 Fail yaml tests and docs snippets that get unexpected warnings
Adds `warnings` syntax to the yaml test that allows you to expect
a `Warning` header that looks like:
```
    - do:
        warnings:
            - '[index] is deprecated'
            - quotes are not required because yaml
            - but this argument is always a list, never a single string
            - no matter how many warnings you expect
        get:
            index:    test
            type:    test
            id:        1
```

These are accessible from the docs with:
```
// TEST[warning:some warning]
```

This should help to force you to update the docs if you deprecate
something. You *must* add the warnings marker to the docs or the build
will fail. While you are there you *should* update the docs to add
deprecation warnings visible in the rendered results.
2016-08-04 15:23:05 -04:00
Daniel Mitterdorfer 4598c36027 Fix various concurrency issues in transport (#19675)
Due to various issues (most notably a missing happens-before edge
between socket accept and channel close in MockTcpTransport),
MockTcpTransportTests sometimes did not terminate.

With this commit we fix various concurrency issues that led to
this hanging test.

Failing example build: https://elasticsearch-ci.elastic.co/job/elastic+elasticsearch+master+multijob-os-compatibility/os=oraclelinux/835/console
2016-08-04 21:00:59 +02:00
Boaz Leskes 7010082112 Add checksumming and versions to the Translog's Checkpoint files (#19797)
This prepares the infrastructure to be able to extend the checkpoint file to store more information.
2016-08-04 20:42:12 +02:00
Luca Cavanna bca9ad86c6 Merge pull request #19808 from javanna/test/parse_alternate_query_strict
[TEST] parse query alternate versions in strict mode
2016-08-04 20:00:22 +02:00
javanna cd9388ce66 [TEST] parse query alternate versions in strict mode
AbstractQueryTestCase parses the main version of the query in strict mode, meaning that it will fail if any deprecated syntax is used. It should do the same for alternate versions (e.g. short versions). This is the way it is because the two alternate versions for ids query are both deprecated. Moved testing for those to a specific test method that isolates the deprecations and actually tests that the two are deprecated.
2016-08-04 19:49:43 +02:00
David Pilato 6b9a084086 Merge branch 'pr/19557-extract-aws-key' 2016-08-04 17:48:44 +02:00
Colin Goodheart-Smithe f1110f6f2a fix import statements 2016-08-04 16:45:05 +01:00
Colin Goodheart-Smithe f273981f37 Added failure message to test 2016-08-04 16:28:12 +01:00
Colin Goodheart-Smithe b6ef99195d Remove offset rounding
This is in favour of doing the offset calculations in the date histogram
2016-08-04 16:24:19 +01:00
Colin Goodheart-Smithe c14155e4a8 Remove TimeZoneRounding abstraction
Because the Rounding class now only deals with date based rounding of
values we can remove the TimeZoneRounding abstraction to simplify the
code.
2016-08-04 16:24:19 +01:00
Colin Goodheart-Smithe 5ab5cc69b8 Remove unused rounding code
Factor rounding and Interval rounding (the non-date based rounding)
was no longer used so it has been removed. Offset rounding has been
retained for no since both date based rounding classes rely on it
2016-08-04 16:24:19 +01:00
Jason Tedor 785624e96b Restore interrupted status on when closing client
When closing a transport client that depends on Netty 4, interrupted
exceptions can be thrown while shutting down some Netty threads. This
commit refactors the handling of these exceptions to finish shutting
down and then just restore the interrupted status.
2016-08-04 11:22:13 -04:00
Clinton Gormley 2cceb0a5f4 Updated v5.0.0-alpha5 release notes 2016-08-04 17:17:53 +02:00
Ali Beyad 34bb150863 [TEST] Fixes primary term in TransportReplicationActionTests#testReplicaProxy 2016-08-04 10:18:48 -04:00
Jason Tedor 2936810c63 Setting exists equals false instead of not exists
This commit rewrites a boolean expression to check for equality with
false instead of negating the existence check.
2016-08-04 10:03:08 -04:00
Ryan Biesemeyer 9f1525255a Update link to mapper-murmur3 plugin in card docs (#19788) 2016-08-04 15:56:59 +02:00
Jason Tedor c08557d033 Wait for Netty 4 threads to terminate on close
Today if the PreBuiltTransportClient is using Netty 4 transport, on
shutdown some Netty 4 threads could linger. This commit causes the
client to wait for these threads to shutdown upon termination.
2016-08-04 09:48:38 -04:00
Colin Goodheart-Smithe b0730bb214 Fix PreBuiltTransportClientTests to run and pass
This change does three things:

1. Makes PreBuiltTransportClientTests run since it was silently
failing on a missing dependency
2. Makes PreBuiltTransportClientTests pass
3. Removes the http.type and transport.type from being set in the
transport clients additional settings since these are set to `netty4` by
default anyway.
2016-08-04 14:15:28 +01:00
Ali Beyad 8bbc312fdd Fixes issue with dangling index being deleted instead of re-imported (#19666)
Fixes an issue where a node that receives a cluster state
update with a brand new cluster UUID but without an
initial persistence block could cause indices to be wiped out,
preventing them from being reimported as dangling indices.
This commit only removes the in-memory data structures and
thus, are subsequently reimported as dangling indices.
2016-08-04 08:47:46 -04:00
Yannick Welsch ede78ad231 Use primary terms as authority to fail shards (#19715)
A primary shard currently instructs the master to fail a replica shard that it fails to replicate writes to before acknowledging the writes to the client. To ensure that the primary instructing the master to fail the replica is still the current primary in the cluster state on the master, it submits not only the identity of the replica shard to fail to the master but also its own shard identity. This can be problematic however when the primary is relocating. After primary relocation handoff but before the primary relocation target is activated, the primary relocation target is replicating writes through the authority of the primary relocation source. This means that the primary relocation target should probably send the identity of the primary relocation source as authority. However, this is not good enough either, as primary shard activation and shard failure instructions can arrive out-of-order. This means that the relocation target would have to send both relocation source and target identity as authority. Fortunately, there is another concept in the cluster state that represents this joint authority, namely primary terms. The primary term is only increased on initial assignment or when a replica is promoted. It stays the same however when a primary relocates.

This commit changes ShardStateAction to rely on primary terms for shard authority. It also changes the wire format to only transmit ShardId and allocation id of the shard to fail (instead of the full ShardRouting), so that the same action can be used in a subsequent PR to remove allocation ids from the active allocation set for which there exist no ShardRouting in the cluster anymore. Last but not least, this commit also makes AllocationService less lenient, requiring ShardRouting instances that are passed to its applyStartedShards and applyFailedShards methods to exist in the routing table. ShardStateAction, which is calling these methods, now has the responsibility to resolve the ShardRouting objects that are to be started / failed, and remove duplicates.
2016-08-04 12:00:37 +02:00
Boaz Leskes d327dd46b1 Recovery: don't log an error when listing an empty folder 2016-08-04 10:23:36 +02:00
javanna 146f02183d [TEST] remove unused methods and fix some warnings in AbstractQueryTestCase
Also fix line length issues
2016-08-04 10:06:25 +02:00
Jason Tedor 533412e36f Improve cat thread pool API
Today, when listing thread pools via the cat thread pool API, thread
pools are listed in a column-delimited format. This is unfriendly to
command-line tools, and inconsistent with other cat APIs. Instead,
thread pools should be listed in a row-delimited format.

Additionally, the cat thread pool API is limited to a fixed list of
thread pools that excludes certain built-in thread pools as well as all
custom thread pools. These thread pools should be available via the cat
thread pool API.

This commit improves the cat thread pool API by listing all thread pools
(built-in or custom), and by listing them in a row-delimited
format. Finally, for each node, the output thread pools are sorted by
thread pool name.

Relates #19721
2016-08-03 23:02:13 -04:00
Jason Tedor 7d750d2811 Increase Netty 3 REST test suite timeout
This commit increases the Netty 3 REST test suite timeout to thirty
minutes. This is to address these tests running slowly after increasing
the number of nodes in the tests to two. This has surfaced that the
tests are heavily impacted by excessive fsyncs from most tests using the
default number of shards of five.
2016-08-03 21:31:48 -04:00
debadair bcc5c7c07a Docs: Fixed callout error that broke the build. 2016-08-03 17:20:00 -07:00
Nik Everett 3be1e7ec35 CONSOLify the completion suggester docs (#19758)
* CONSOLEify search/suggesters/completion
* CONSOLEify context suggester docs
2016-08-03 18:40:17 -04:00
Ali Beyad be87d50f32 Fixes CreateIndexIT test that assumes an index create propogated
before calling delete.
2016-08-03 16:24:24 -04:00
Nik Everett e249ad8dfe Fix loggerUsageCheck after clean
The `loggerUsageCheck` can only run on directories that exist. It was
checking whether or not the directories exists before they were built
built and then deciding to do no work. But only if you are building in
a cleaned environment which CI does, but people rarely do locally.
2016-08-03 15:36:11 -04:00
Jason Tedor eb6da69e9f Explicitly tell Netty to not use unsafe
With the security permissions that we grant to Netty, Netty can not
access unsafe (because it relies on having the runtime permission
accessDeclaredMembers and the reflect permission
suppressAccessChecks). Instead, we should just explicitly tell Netty to
not use unsafe. This commit adds a flag to the default jvm.options to
tell Netty to not look for unsafe.

Relates #19786
2016-08-03 15:23:34 -04:00
Ryan Ernst c3a5e4fa48 Merge pull request #19765 from rjernst/metadata_mapper_dup
Mappings: Fix detection of metadata fields in documents
2016-08-03 11:58:24 -07:00