Commit Graph

6832 Commits

Author SHA1 Message Date
Colin Goodheart-Smithe 6614cc73cc Fixes compile error in Eclipse in ClusterRerouteRequestTests (#21400)
Before this change Eclipse (4.6.1) would show compile errors in `ClusterRerouteRequestTests` for the elements in `RANDOM_COMMAND_GENERATORS`. This seems to be because the eclipse compiler does not recognised that the elements in the list are all `Supplier`s of bjects that are subclasses of `AllocationCommand`.

This change fixes the problem by adding a generics hint to the `Arrays.toList()` call.
2016-11-08 10:26:55 +00:00
Ryan Ernst 6b4280c7be Better fix for java8 restriction of g1gc check
This makes the fix actually testable.
2016-11-07 17:04:41 -08:00
Ryan Ernst 562a30d3c6 Move licenses for core jar to core directory (#21383)
All plugins currently have their own licenses dir for the
dependencyLicenses task, but core disables this and has the check inside
distribution. This may have been better for maven, but for
gradle it makes more sense to just use the dependencyLicenses task that
automatically exists inside :core, and remove the hacked up version that
is inside distribution.
2016-11-07 15:29:35 -08:00
Ryan Ernst f833114492 Fix g1gc bootstrap check to only try parsing java version for java 8 2016-11-07 15:05:18 -08:00
Jason Tedor 7c31e8cc58 Modify Javadoc line length in OsProbe.java
This commit changes the Javadocs in OsProbe.java to take advantage of
the fact that the line-length limit is 140 characters. This change makes
these Javadocs easier to read and easier to maintain.
2016-11-07 17:26:28 -05:00
Jason Tedor 6a6e1bed55 Remove JVMCheck
This commit removes JVMCheck. Previously there were three checks in this
class:
 - check for super word bug in JDK 7
 - check for G1GC bugs in JDK 8
 - check for broken IBM JDKs

The first check is obsolete since we require JDK 8 now. The second check
is refactored into a bootstrap check. The third check is removed since
we do not even support the IBM JDK.

Relates #21389
2016-11-07 16:35:39 -05:00
Jason Tedor b30732c464 Migrate G1GC JVM check to bootstrap check
This commit fixes an assertion in G1GCCheck#jvmVersion that was
mistakenly asserting on itself.

Relates #21388
2016-11-07 16:19:05 -05:00
Jason Tedor f80aa65fe9 Remove JDK 7 checks from JVMCheck
This commit removes checks for buggy JDK 7 JVMs from the JVM check as
Elasticsearch does not support JDK 7.

Relates #21381
2016-11-07 15:50:06 -05:00
jaymode 3cad92a631
assert blocking calls are not made on the cluster state update thread
This commit adds an assertion to ensure that we do not introduce blocking calls in code
that is called in a ClusterStateListener or another part of the cluster state update process.
2016-11-07 14:21:12 -05:00
Ali Beyad 871a077ac4 Fixes get snapshot duplicates when asking for _all (#21340)
Before, when requesting to get the snapshots in a repository, if `_all` was
specified for the set of snapshots to get, any in-progress snapshots would
be returned twice.  This commit fixes the issue ensuring that each snapshot,
whether in-progress or completed, is only returned once when making a call to
get snapshots (GET /_snapshot/{repository_name}/_all).

This commit also enables `_current` to appear anywhere in 
the get snapshots list, and will be used as a pseudo regex to
mean "match any currently running snapshots".

Closes #21335
2016-11-07 14:20:28 -05:00
Jason Tedor 8067412983 Remove load average leniency
Today when acquiring load average stats, this method is rather lenient
when reading /proc/loadavg. This commit removes this leniency so that
any such issues are more likely to be exposed to the end-user.

Relates #21380
2016-11-07 14:04:04 -05:00
Adrien Grand 457c87affb Fix PercentilesBucketIT expectations. 2016-11-07 13:48:04 +01:00
Alexander Kazakov c92b4b30a0 Percentiles bucket fails for 100th percentile (#21218)
It mistakenly multiplies the quantile by the array `length` instead of `length-1`.
2016-11-07 13:02:09 +01:00
Nik Everett a13a050271 Add automatic parallelization support to reindex and friends (#20767)
Adds support for `?slices=N` to reindex which automatically
parallelizes the process using parallel scrolls on `_uid`. Performance
testing sees a 3x performance improvement for simple docs
on decent hardware, maybe 30% performance improvement
for more complex docs. Still compelling, especially because
clusters should be able to get closer to the 3x than the 30%
number.

Closes #20624
2016-11-04 20:59:15 -04:00
Jason Tedor 555084a226 Write -1 on unbounded queue in cat thread pool
Today when writing an unbounded queue_size in the cat thread pool API,
we write null. This commit modifies this so that the output is -1 so
that the output is always present, and always a numeric value.

Relates #21342
2016-11-04 15:17:55 -04:00
Luca Cavanna c2160a88b5 Remove support for controversial ignore_unavailable and allow_no_indices from indices exists api (#20712)
Exist requests are supposed to never throw an exception, but rather return true or false depending on whether some resource exists or not. Indices exists does that for indices and accepts wildcard expressions too. The way the api works internally is by resolving indices and catching IndexNotFoundException: if an exception is thrown the index does not exist hence it returns false, otherwise it returns true. That works ok only if ignore_unavailable and allow_no_indices indices options are both set to false, meaning that they are strict and any missing index or wildcard expressions that resolves to no indices will lead to an exception that can be thrown and cause false to be returned.

Unfortunately the indices options have  been configurable up until now for this request, meaning that one can set ignore_unavailable or allow_no_indices to true and have the indices exist request return true for indices that really don't exist, which makes very little sense in the context of this api.

This commit removes the indicesOptions setter from the IndicesExistsRequest and makes settable only expandWildcardsOpen and expandWildcardsClosed, hence a subset of the available indices options. This way we can guarantee more consistent behaviour of the indices exists api. We can then remove the ignore_unavailable and allow_no_indices option from indices exists api spec
2016-11-04 19:26:37 +01:00
Jason Tedor f16c308efd Assert status logger does not warn on Log4j usage
Today if you start Elasticsearch with the status logger configured to
the warn level, or use a transport client with the default status logger
level, you will see warn messages about deprecation loggers being
created with different message factories and that formatting might be
broken. This happens because the deprecation logger is constructed using
the message factory from its parent, an artifact leftover from the first
Log4j 2 implementation that used a custom message factory. When that
custom message factory was removed, this constructor invocation should
have been changed to not explicitly use the message factory from the
parent. This commit fixes this invocation. However, we also had some
status checking to all tests to ensure that there are no warn status log
messages that might indicate a configuration problem with Log4j 2. These
assertions blow up badly without the fix for the deprecation logger
construction, and also caught a misconfiguration in one of the logging
tests.

Relates #21339
2016-11-04 14:19:59 -04:00
Simon Willnauer e042536082 Fix SpanMultiTermQueryBuilderTest by using a mock query 2016-11-04 16:00:53 +01:00
Simon Willnauer 436ba7b5fc Validate the `_rollover` target index name early to also fail if dry_run=true (#21330)
Today we validate the target index name late and therefore don't fail for instance
if the target index already exists and `dry_run=true` was specified. This change
validates the index name before we early terminate if dry_run is set.

Closes #21149
2016-11-04 13:53:28 +01:00
Simon Willnauer ed2865863c Remove LateParsingQuery to prevent timestamp access after context is frozen (#21328)
Today we still have a leftover from older percolators where lucene
query instances where created ahead of time and rewritten later.
This `LateParsingQuery` was resolving `now()` when it's really used which we
don't need anymore. As a side-effect this failed to execute some highlighting
queries when they get rewritten since at that point `now` access it not permitted
anymore to prevent bugs when queries get cached.

Closes #21295
2016-11-04 13:53:03 +01:00
Lee Hinman 6666fb1614 Add "all field" execution mode to query_string query
This commit introduces a new execution mode for the query_string query, which
is intended down the road to be a replacement for the current _all field.

It now does auto-field-expansion and auto-leniency when the following criteria
are ALL met:

    The _all field is disabled
    No default_field has been set in the index settings
    No default_field has been set in the request
    No fields are specified in the request

Additionally, a user can force the "all-like" execution by setting the
all_fields parameter to true.

When executing in all field mode, the query_string query will look at all the
fields in the mapping that are not metafields and can be searched, and
automatically expand the list of fields that are going to be queried.

Relates to #19784
2016-11-04 05:46:18 -06:00
Christoph Büscher 6acbefe3f7 Add tests for alternative ways of writing zero offset timezones
According to ISO 8601, a time zone offset of zero, can be stated numerically as
"+00:00", "+0000", or "00". The Joda library also seems to allow for "-00:00",
"-00" and "-0000". This adds some test to the DateMathParserTests that check
that we also conform to this.

Closes #21320
2016-11-04 12:24:40 +01:00
Christoph Büscher f4594d4302 Removing plugin that isn't installed shouldn't trigger usage information
The usage information for `elasticsearch-plugin` is quiet verbose and makes the
actual error message that is shown when trying to remove an non-existing plugin
hard to spot. This changes the error code to not trigger printing the usage
information.

Closes #21250
2016-11-04 11:46:20 +01:00
Adrien Grand 2a70f6e7b1 Upgrade to lucene-6.3.0-snapshot-a66a445. (#21309)
This addresses a bug that was introduced with https://issues.apache.org/jira/browse/LUCENE-7501.
2016-11-04 10:34:04 +01:00
Jason Tedor c3e176908c Fix ShardInfo#toString
ShardInfo#toString resorts to calling ShardInfo#toXContent via
Strings#toString. However, the resulting XContent object will not start
with an object, and this is a violation of the generator state
machine. This commit fixes this issue by replacing the override of
toString to provide simple non-toXContent output of the ShardInfo
instance. Without this fix, ShardInfo#toString will instead produce
"Error building toString out of XContent:
com.fasterxml.jackson.core.JsonGenerationException: Can not write a
field name, expecting a value"

Relates #21319
2016-11-03 20:40:39 -04:00
Yannick Welsch 39f4229594 Add information about in-flight requests when checking IndexShard operation counter (#21308)
Our test infrastructure checks after running each test that there are no more in-flight requests on the shard level. Whenever the check fails, we only know that there were in-flight requests but don't know what requests were causing this issue. This commit adds the replication tasks that are still active at that moment to the assertion error.
2016-11-03 18:36:07 +01:00
Luca Cavanna 00e7026778 Read indices options in indices upgrade API (#21281)
With #21099 we removed support for the ignored allow_no_indices parameter in indices upgrade API. Truth is that ignore_unavailable and expand_wildcards were also ignored, in indices upgrade as well as upgrade status API. Those parameters are though supported internally and settable through java API, hence they should be all supported on the REST layer too.
2016-11-03 18:05:18 +01:00
Simon Willnauer 9015062dcb Rewrite Queries/Filter in FilterAggregationBuilder and ensure client usage marks query as non-cachable (#21303)
`FilterAggregationBuilder` today misses to rewrite queries which causes failures
if a query that uses a client for instance to lookup terms since it must be rewritten first.
This change also ensures that if a client is used from the rewrite context we mark the query as
non-cacheable.

Closes #21301
2016-11-03 16:48:55 +01:00
Ryan Ernst dc6ed7b8d4 Remove pluggability of ZenPing (#21049)
Plugins: Remove pluggability of ZenPing

ZenPing is the part of zen discovery which knows how to ping nodes.
There is only one alternative implementation, which is just for testing.
This change removes the ability to add custom zen pings, and instead
hooks in the MockZenPing for tests through an overridden method in
MockNode. This also folds in the ZenPingService (which was really just a
single method) into ZenDiscovery, and removes the idea of having
multiple ZenPing instances. Finally, this was the last usage of the
ExtensionPoint classes, so that is also removed here.
2016-11-03 08:20:20 -07:00
Simon Willnauer 1fb8723323 [TEST] Add tests that combines highlighting and NOW parsing
Relates to #21295
2016-11-03 11:23:38 +01:00
Simon Willnauer d77d4fa63a Consume `full_id` request parameter early (#21270)
Since we now validate all consumed request parameter, users can't specify
`_cat/nodes?full_id=true|false` anymore since this parameter is consumed late.
This commit adds a test for this parameter and consumes it before request is processed.

Closes #21266
2016-11-03 10:31:35 +01:00
Adrien Grand cf667bcbd6 Create the QueryShardContext lazily in DocumentMapperParser. (#21287)
This would allow MapperService to still be usable in contexts when a
QueryShardContext cannot be obtained, for instance in the case that a
MapperService needs to be created only to merge mappings.
2016-11-03 08:58:53 +01:00
Adrien Grand 5d79eab982 Fix the request cache keys to not hold references to the SearchContext. (#21284)
Currently the request cache adds a `CacheEntity` object. It looks quite innocent
but in practice it has a reference to a lambda that knows how to create a value.
The issue is that this lambda has implicit references to the SearchContext
object, which can be quite heavy since it holds a structured representation of
aggregations for instance.

This pull request splits the `CacheEntity` object from the object that generates
cache values.
2016-11-03 08:58:15 +01:00
Igor Motov 5f77ddf45d ClusterAdminClient.prepareDeletePipeline method should accept pipeline id to delete
Currently there is no way to specify the pipeline id when using client().prepareDeletePipeline() method
2016-11-02 14:19:19 -10:00
Areek Zillur 2110221f59 add EngineClosed and IndexShardClosed exceptions to assertions on executing bulk shard operation on replica 2016-11-02 20:18:31 -04:00
Igor Motov 2e652d3b57 Stored scripts and ingest node configurations should be included into a snapshot
Stored scripts and ingest node configuration are important parts of the overall cluster state and should be included into a snapshot together with index templates and persistent settings if the includeGlobalState is set to true.

Closes #21184
2016-11-02 13:21:12 -10:00
Luca Cavanna 9624fd26a8 [TEST] Update destructive operations and disable close IT tests (#21274)
These tests had a single method due to the fact that es didn't support resetting settings when they were first written. They can now be rewritten to have separate methods and an after method that resets the setting that is left behind.
2016-11-02 20:02:48 +01:00
Christoph Büscher b3370de715 Tests: Add warning header checks to QueryBuilder tests and QueryParseContextTests
This adds checks for expected warning headers to the query builder test
infrastructure. Tests that are adding deprecation warnings to the response
headers need to check those, otherwise the abstract base class for the test
class will complain at teardown.
2016-11-02 15:45:33 +01:00
Christoph Büscher a0c094d0c1 Add deprecation logging message for 'fuzzy' query
This query is deprecated from 5.0 on. Similar to IndicesQueryBuilder we should
log a deprecation warning whenever this query is used.

Relates to #15760
2016-11-02 15:45:33 +01:00
Boaz Leskes 7276737a03 Publishing a cluster state should clear the pending states queue (#21259)
The pending cluster state queue is used to hold incoming cluster states from the master. Currently the elected master doesn't publish to itself as thus the queue is not used. Sometimes, depending on the timing of disruptions, a pending cluster state can be put on the queue (but not committed) but another master before being isolated. If this happens concurrently with a master election the elected master can have a pending cluster state in its queue. This is not really a problem but it does confuse our assertions during tests as we check to see everything was processed correctly.

This commit takes a temporary step to clear (and fail) any pending cluster state on the master after it has successfully published a CS. Most notably this will happen when the master publishes the cluster state indicating it has just become the master.

Long term we are working to change the publishing mechanism to make the master use the pending queue just like other nodes, which will make this a non issue.

See https://elasticsearch-ci.elastic.co/job/elastic+elasticsearch+5.x+java9-periodic/509 for example.
2016-11-02 14:58:15 +01:00
Adrien Grand 52de0645fb Remove `lowercase_expanded_terms` and `locale` from query-parser options. (#20208)
Lucene 6.2 introduces the new `Analyzer.normalize` API, which allows to apply
only character-level normalization such as lowercasing or accent folding, which
is exactly what is needed to process queries that operate on partial terms such
as `prefix`, `wildcard` or `fuzzy` queries. As a consequence, the
`lowercase_expanded_terms` option is not necessary anymore. Furthermore, the
`locale` option was only needed in order to know how to perform the lowercasing,
so this one can be removed as well.

Closes #9978
2016-11-02 14:25:08 +01:00
Adrien Grand 638353cda3 `query_string` can now automatically generate phrase queries. 2016-11-02 13:56:53 +01:00
Boaz Leskes 0daf483587 Change ClusterState and PendingClusterTasksResponse's toString() to their prettyPrint format (#21245)
The current XContent output is much harder to read than the prettyPrint format. This commit folds prettyPrint into toString and removes it.
2016-11-02 13:43:39 +01:00
Boaz Leskes 2187b65809 TransportShardBulkAction: add the exception to the message of an assertion about it's type 2016-11-02 13:38:21 +01:00
Luca Cavanna abc3ec6574 Remove special case in case no action filters are registered (#21251)
Since we have the ingest node type, there is either IngestActionFilter or IngestProxyActionFilter registered, depending on whether the node is an ingest node or not. The special case that shortcuts the execution in case there are no filters is never exercised.
2016-11-02 10:38:25 +01:00
Adrien Grand acb12ecfa7 Protect BytesStreamOutput against overflows of the current number of written bytes. (#21174)
Closes #21159
2016-11-02 10:11:14 +01:00
Jim Ferenczi 9d6fac809c Expose splitOnWhitespace in `Query String Query` (#20965)
This change adds an option called `split_on_whitespace` which prevents the query parser to split free text part on whitespace prior to analysis. Instead the queryparser would parse around only real 'operators'. Default to true.
For instance the query `"foo bar"` would let the analyzer of the targeted field decide how the tokens should be splitted.
Some options are missing in this change but I'd like to add them in a follow up PR in order to be able to simplify the backport in 5.x. The missing options (changes) are:
* A `type` option which similarly to the `multi_match` query defines how the free text should be parsed when multi fields are defined.
* Simple range query with additional tokens like ">100 50" are broken when `split_on_whitespace` is set to false. It should be possible to preserve this syntax and make the parser aware of this special syntax even when `split_on_whitespace` is set to false.
* Since all this options would make the `query_string_query` very similar to a match (multi_match) query we should be able to share the code that produce the final Lucene query.
2016-11-02 10:00:40 +01:00
Adrien Grand aa6cd93e0f Require arguments for QueryShardContext creation. (#21196)
The `IndexService#newQueryShardContext()` method creates a QueryShardContext on
shard `0`, with a `null` reader and that uses `System.currentTimeMillis()` to
resolve `now`. This may hide bugs, since the shard id is sometimes used for
query parsing (it is used to salt random score generation in `function_score`),
passing a `null` reader disables query rewriting and for some use-cases, it is
simply not ok to rely on the current timestamp (eg. percolation). So this pull
request removes this method and instead requires that all call sites provide
these parameters explicitly.
2016-11-02 09:48:49 +01:00
Simon Willnauer 51717c882f [TEST] add back AwaitsFix until we get a new Lucene 6.3.0 snapshot 2016-11-02 09:38:59 +01:00
Simon Willnauer 2ba4dadea0 [TEST] fix extrasFS file filtering in OldIndexUtils 2016-11-02 09:38:51 +01:00
Simon Willnauer 4db1ac931f Fix InternalEngineTests#testUpgradeOldIndex for 5.0.0 BWC indices
Relates to #21147
2016-11-02 09:38:44 +01:00
Ali Beyad 9303165615 Balance step in BalancedShardsAllocator for a single shard (#21103)
This commit introduces a single-shard balance step for deciding on
rebalancing a single shard (without taking any other shards in the
cluster into account).  This method will be used by the cluster
allocation explain API to explain in detail the decision process for
finding a more optimal location for a started shard, if one exists.
2016-11-01 21:29:37 -04:00
Areek Zillur 03abf4a1a7 Merge pull request #19105 from areek/enhancement/replicate_primary_write_failures
Simplify write failure handling
2016-11-01 18:10:16 -04:00
Areek Zillur ee0b2733d1 add back index and delete engine failure exceptions as deprecated for bwc with 5.x 2016-11-01 16:21:43 -04:00
Areek Zillur cf3e2d1aa8 documentation and minor fixes for engine level index/delete operations 2016-11-01 15:31:28 -04:00
Lee Hinman eb4b6cd816 Disallow VersionType.FORCE for GetRequest (#21079)
This doesn't make much sense to have at all, since a user can do a `GET`
request without a version of they want to get it unconditionally.

Relates to #20995
2016-11-01 12:15:56 -06:00
Jason Tedor 7751049c14 Add version for 5.0.0
This commit adds the version constant for 5.0.0.

Relates #21244
2016-11-01 14:09:00 -04:00
Areek Zillur 603d5063a0 Merge branch 'master' into enhancement/replicate_primary_write_failures 2016-11-01 13:37:50 -04:00
Boaz Leskes 523f7ea71e Fix a racing condition in MockTransportService#addUnresponsiveRule where a request can be delayed even if the rule was removed.
Relates to #21129

Also properly reset DiscoveryWithServiceDisruptionsIT#disableBeforeIndexDeletion
2016-11-01 14:08:18 +01:00
Jay Modi 6e7e89159b ensure the XContentBuilder is always closed in RestBuilderListener
There may be cases where the XContentBuilder is not used and therefore it never gets
closed, which can cause a leak of bytes. This change moves the creation of the builder
into a try with resources block and adds an assertion to verify that we always consume
the bytes in our code; the try-with resources provides protections against memory leaks
caused by plugins, which do not test this.
2016-11-01 09:02:05 -04:00
Areek Zillur 02ecff13e4 incorporate feedback 2016-10-31 23:50:09 -04:00
Jack Conradson 185dff7346 Cleanup ScriptType (#21179)
Refactored ScriptType to clean up some of the variable and method names. Added more documentation. Deprecated the 'in' ParseField in favor of 'stored' to match the indexed scripts being replaced by stored scripts.
2016-10-31 13:48:51 -07:00
Boaz Leskes c10a6ddec1 IndexService#maybeRefresh should catch `IndexShardClosedException` (#21205)
We throw this exception in some cases that the shard is closed, so we have to be consistent here. Otherwise we get logs like:

```
 1> [2016-10-30T21:06:22,529][WARN ][o.e.i.IndexService       ] [node_s_0] [test] failed to run task refresh - suppressing re-occurring exceptions unless the exception changes
 1> org.elasticsearch.index.shard.IndexShardClosedException: CurrentState[CLOSED] operation only allowed when not closed
 1> 	at org.elasticsearch.index.shard.IndexShard.verifyNotClosed(IndexShard.java:1147) ~[main/:?]
 1> 	at org.elasticsearch.index.shard.IndexShard.verifyNotClosed(IndexShard.java:1141) ~[main/:?]
```
2016-10-31 20:04:33 +01:00
Areek Zillur eafd3dfc55 Merge branch 'master' into enhancement/replicate_primary_write_failures 2016-10-31 13:06:21 -04:00
Yannick Welsch d7d5909e69 Disconnect from newly added nodes if cluster state publishing fails (#21197)
Before publishing a cluster state the master connects to the nodes that are added in the cluster state. When publishing fails, however, it does not disconnect from these nodes, leaving NodeConnectionsService out of sync with the currently applied cluster state.
2016-10-31 15:09:43 +01:00
Yannick Welsch 37228f924a [TEST] Use assertBusy to check assertMaster property in presence of a low publish timeout
The assertion assertMaster checks if all nodes have each other in the cluster state and the correct master set.
It is usually called after a disruption has been healed and ensureStableCluster been called. In presence of a low
publish timeout of 1s in this test class, publishing might not be fully done even after ensureStableCluster returns.
This commit adds an assertBusy to assertMaster so that the node has a bit more time to apply the cluster state from
the master, even if it's a bit slow.
2016-10-31 14:04:18 +01:00
Boaz Leskes e7cfe101e4 Retrying replication requests on replica doesn't call `onRetry` (#21189)
Replication request may arrive at a replica before the replica's node has processed a required mapping update. In these cases the TransportReplicationAction will retry the request once a new cluster state arrives. Sadly that retry logic failed to call `ReplicationRequest#onRetry`, causing duplicates in the append only use case.

This commit fixes this and also the test which missed the check. I also added an assertion which would have helped finding the source of the duplicates.

This was discovered by https://elasticsearch-ci.elastic.co/job/elastic+elasticsearch+master+multijob-unix-compatibility/os=opensuse/174/

Relates #20211
2016-10-31 13:43:55 +01:00
Igor Motov d731a330aa Tests: Add addtional logging to SearchCancellationIT tests 2016-10-28 11:29:49 -10:00
Boaz Leskes b9691d15ae IndexWithShadowReplicasIT.testReplicaToPrimaryPromotion should wait for node leave to be processed 2016-10-28 20:22:24 +02:00
Adrien Grand b3cc54cf0d Upgrade to lucene-6.3.0-snapshot-ed102d6 (#21150)
Lucene 6.3 is expected to be released in the next weeks so it'd be good to give
it some integration testing. I had to upgrade randomized-testing too so that
both Lucene and Elasticsearch are on the same version.
2016-10-28 14:47:15 +02:00
Adrien Grand 9cbbddb6dc Add support for `quote_field_suffix` to `simple_query_string`. (#21060)
Closes #18641
2016-10-28 09:11:57 +02:00
Areek Zillur 2f883fcb85 Rethrow original exception when it fails the engine during write operations 2016-10-27 16:38:15 -04:00
Simon Willnauer 97cc426a89 Fix bwc cluster formation in order to run BWC tests against a mixed version cluster (#21145)
This fixes our cluster formation task to run REST tests against a mixed version cluster.
Yet, due to some limitations in our test framework `indices.rollover` tests are currently
disabled for the BWC case since they select the current master as the merge node which
happens to be a BWC node and we can't relocate all shards to it since the primaries are on
a higher version node. This will be fixed in a followup.

Closes #21142

Note: This has been cherry-picked from 5.0 and fixes several rest tests
as well as a BWC break in `OsStats.java`
2016-10-27 17:03:53 +02:00
markharwood 9944a594b1 Aggregations fix: scripted heuristics for scoring significant_terms aggs were not thread safe when running local to the coordinating node. New code spawns an object for each shard search execution rather than sharing a common instance which is not thread safe.
Closes #18120
2016-10-27 13:56:48 +01:00
Yannick Welsch f3e578f942 Stop delaying existing requests after network delay rule is cleared (#21129)
The network disruption type "network delay" continues delaying existing requests even after the disruption has been cleared. This commit ensures that the requests get to execute right after the delay rule is cleared.
2016-10-27 13:48:17 +02:00
Yannick Welsch 952097b1c0 [TEST] Fix testDelayShards to wait for master to remove stopped node
This test failed when the node that was shutting down was not yet removed from the cluster state on the master.
The cluster allocation explain API will not see any unassigned shards until the node shutting down is removed from the
cluster state.
2016-10-27 12:02:00 +02:00
Yannick Welsch 118913b553 [TEST] Fix testRolloverConditionsNotMet to expect correct rollover index name
PR #21138 changed the target index name even if _rollover conditions are not met but missed to adapt this test.
2016-10-27 11:00:44 +02:00
Jun Ohtani a66c76eb44 Merge pull request #20704 from johtani/remove_request_params_in_analyze_api
Removing request parameters in _analyze API
2016-10-27 17:43:18 +09:00
Simon Willnauer e745015325 Return target index name even if _rollover conditions are not met (#21138)
Today we return the old index name as the target / new index name.
This change passes the correct rollover index name to the response.
2016-10-27 09:20:46 +02:00
Areek Zillur 947a17ee37 cleanup operation listener handling of failure in results 2016-10-27 00:26:01 -04:00
Areek Zillur 7fb44a3ab6 add tests 2016-10-27 00:26:01 -04:00
Areek Zillur fa3ee6b996 Incorporate feedback 2016-10-27 00:25:55 -04:00
Jack Conradson 512a77a633 Refactor ScriptType to be a top-level class. 2016-10-26 10:21:22 -07:00
Areek Zillur a3fcfe8196 add constructor overloads for primary result 2016-10-26 12:07:32 -04:00
Areek Zillur 65832b987f Revert "cleanup indexing operation listener"
This reverts commit bb785483ae.
2016-10-26 11:23:09 -04:00
Ali Beyad c88452dc80 Abort snapshots on a node that leaves the cluster (#21084)
Previously, if a node left the cluster (for example, due to a long GC),
during a snapshot, the master node would mark the snapshot as failed, but
the node itself could continue snapshotting the data on its shards to the
repository. If the node rejoins the cluster, the master may assign it to
hold the replica shard (where it held the primary before getting kicked off
the cluster). The initialization of the replica shard would repeatedly fail
with a ShardLockObtainFailedException until the snapshot thread finally
finishes and relinquishes the lock on the Store.

This commit resolves the situation by ensuring that when a shard is removed
from a node (such as when a node rejoins the cluster and realizes it no longer
holds the active shard copy), any snapshotting of the removed shards is aborted.
In the scenario above, when the node rejoins the cluster, it will see in the cluster 
state that the node no longer holds the primary shard, so IndicesClusterStateService
will remove the shard, thereby causing any snapshots of that shard to be aborted.

Closes #20876
2016-10-26 10:04:50 -04:00
Yannick Welsch e82a1f5cca Only allow the master to update the list of nodes in the cluster state (#21092)
The cluster state on a node is updated either
- by incoming cluster states that are received from the active master or
- by the node itself when it notices that the master has gone.

In the second case, the node adds the NO_MASTER_BLOCK and removes the current master as active master from its cluster state. In one particular case, it would also update the list of nodes, removing the master node that just failed. In the future, we want a clear separation between actions that can be executed by a master publishing a cluster state and a node locally updating its cluster state when no active master is around.
2016-10-26 09:24:03 +02:00
Igor Motov e6dda02c66 Tests: silence cancelling scroll search tests
Investigating it locally
2016-10-25 20:06:05 -10:00
Igor Motov 6fe3bd817b Tests: make sure that 2 segments are created in SearchCancellationTests
Otherwise, the test fails if forced merge kicks in.
2016-10-25 20:05:49 -10:00
Jason Tedor 9c3e4d6e22 Add correct Content-Length on HEAD requests
This commit fixes responses to HEAD requests so that the value of the
Content-Length is correct per the HTTP spec. Namely, the value of this
header should be equal to the Content-Length if the request were not a
HEAD request.

This commit also fixes a memory leak on HEAD requests to the main action
that arose from the bytes on a builder not being released due to them
being dropped on the floor to ensure that the response to the main
action did not have a body.

Relates #21123
2016-10-25 23:08:19 -04:00
Igor Motov 17ad88d539 Makes search action cancelable by task management API
Long running searches now can be cancelled using standard task cancellation mechanism.
2016-10-25 12:27:34 -10:00
Britta Weber 7945894ede Remove unused interface InitialStateDiscoveryListener (#21115) 2016-10-25 18:29:23 +02:00
Areek Zillur c237263ad1 fix computing took for write operation result 2016-10-25 10:42:09 -04:00
Areek Zillur 7a6f56a692 fix tests 2016-10-25 10:22:32 -04:00
Areek Zillur 1ad1e2730d fix wildcard import 2016-10-25 10:00:44 -04:00
Areek Zillur 64a897e5f2 add setters for translog location and took in engine operation result 2016-10-25 09:58:14 -04:00
Areek Zillur bb785483ae cleanup indexing operation listener 2016-10-25 09:33:04 -04:00
Areek Zillur 168946ad5a Improve documentation for handling write operation failure 2016-10-25 09:22:49 -04:00
Areek Zillur 1aee578aa1 add operation result as a parameter to postIndex/delete in indexing operation listener 2016-10-25 09:12:39 -04:00
Areek Zillur 1587a77ffd Revert "Generify index shard method to execute engine write operation"
This reverts commit 1bdeada8aa.
2016-10-25 09:11:16 -04:00
Jason Tedor 1bc08ff1e5 Fix empty <p> tag warning in o/e/m/o/OsProbe.java
This commit fixes an empty <p> tag warning in o/e/m/o/OsProbe.java.
2016-10-25 08:33:15 -04:00
Jason Tedor b89c5aff51 Add preformatted tags to Javadoc in OsProbe
This commit adds preformatted tags to the Javadoc for
OsProbe#readSysFsCgroupCpuAcctCpuStat to render the form of the cpu.stat
file in a fixed-width font.
2016-10-25 08:19:10 -04:00
Jason Tedor 9a6c81c9f1 Mock areCgroupStatsAvailable in OsProbeTests
When acquiring cgroup stats, we check if such stats are available by
invoking a method areCgroupStatsAvailable. This method checks
availability by looking for existence of some virtual files in
/proc/self/cgroup and /sys/fs/cgroups. If these stats are not available,
the getCgroup method returns null. The OsProbeTests#testCgroupProbe did
not account for this. On some systems where tests run, the cgroup stats
might not be available yet this test method was expecting them to be (we
mock the relevant virtual file reads). This commit handles the execution
of this test on such systems by overriding the behavior of
OsProbe#areCgroupStatsAvailable. We test both the possibility of this
method returning true as well as false.
2016-10-24 19:59:48 -04:00
Jason Tedor de241f441d Remove unused import from o/e/m/o/OsProbe.java
This commit removes an unused import from o/e/m/o/OsProbe.java.
2016-10-24 16:40:41 -04:00
Jason Tedor 900ee0536e Strengthen handling of unavailable cgroup stats
On some systems, cgroups will be available but not configured. And in
some cases, cgroups will be configured, but not for the subsystems that
we are expecting (e.g., cpu and cpuacct). This commit strengthens the
handling of cgroup stats on such systems.

Relates #21094
2016-10-24 16:36:51 -04:00
Christoph Büscher e8a3225719 Tests: Fix compile issue with type inference on java 9 build 2016-10-24 19:59:08 +02:00
Christoph Büscher a43f70522c Tests: fix issue with SliceBuilderTests creation of mutated test objects 2016-10-24 18:48:18 +02:00
Li Weinan d4e42b77a5 .es_temp_file remains after system crash, causing it not to start again #21007
When system starts, it creates a temporary file named .es_temp_file to ensure the data directories are writable.

If system crashes after creating the .es_temp_file but before deleting this file, next time the system will not be able to start because the Files.createFile(resolve) will throw an exception if the file already exists.
2016-10-24 16:41:36 +02:00
Christoph Büscher f6f129b21f Consolidate code for equals/hashCode testing in central utility class
Currently test that check that equals() and hashCode() are working as expected
for classes implementing them are quiet similar. This change moves common
assertions in this method to a common utility class. In addition, another common
utility function in most of these test classes that creates copies of input
object by running them through a StreamOutput and reading them back in, is moved
to ESTestCase so it can be shared across all these classes.

Closes #20629
2016-10-24 15:50:40 +02:00
Jason Tedor 3d642ab0eb Add basic cgroup CPU metrics
This commit adds basic cgroup CPU metrics to the node stats API.

Relates #21029
2016-10-24 08:26:56 -04:00
Simon Willnauer 0a410d3916 Pass executor name to request interceptor to support async intercept calls (#21089)
Today the request interceptor can't support async calls since the response
of the async call would execute on a different thread ie. a client or listener
thread. This means in-turn that the intercepted handler is not executed with the
thread it was supposed to run and therefor can, if it's executing blocking
operations, potentially deadlock an entire server.
2016-10-24 13:57:07 +02:00
Tanguy Leroux 127b4a8efc Change permissions on config files (#20966)
This commit changes some default file permissions on configuration files.
2016-10-24 09:42:03 +02:00
Igor Motov 04c7665432 Fix NPE in SearchContext.toString()
Fixes NPE in SearchContext.toString() for user requests that contain scroll id but not scroll timeout.
2016-10-21 12:49:46 -10:00
Nik Everett 8cc22eb960 Make sure HEAD / has 0 Content-Length (#21077)
Before this commit `curl -XHEAD localhost:9200?pretty` would return
`Content-Length: 1` and a body which is fairly upsetting to standards
compliant tools. Now it'll return `Content-Length: 0` with an empty
body like every other `HEAD` request.

Relates to #21075
2016-10-21 16:44:50 -04:00
Ali Beyad 3d2e885157 Separates decision making from decision application in BalancedShardsAllocator (#20634)
Refactors the BalancedShardsAllocator to create a method that
provides an allocation decision for allocating a single
unassigned shard or a single started shard that can no longer
remain on its current node.  Having a separate method that
provides a detailed decision on the allocation of a single shard
will enable the cluster allocation explain API to directly
invoke these methods to provide allocation explanations.
2016-10-21 15:33:27 -04:00
Areek Zillur 7c11a2b732 cleanup and improve documentation for TWA 2016-10-21 14:50:20 -04:00
Christoph Büscher 8329bf145a Tests: Add test for parsing InnerHits with highlight query
This adds a test from #21065 that checks correct highlighting of inner hits of a
has-child query when using a nested highlight query.
2016-10-21 20:44:24 +02:00
Adrien Grand d88239ba63 `ip_range` aggregation should accept null bounds. (#21043)
* `ip_range` aggregation should accept null bounds.

Closes #21006

* test

* iter
2016-10-21 14:39:00 +02:00
Jason Tedor 3b2eff665e Fix typo in exception message in RestGetAction
This commit fixes a duplicated word in an exception message in
RestGetAction.
2016-10-21 07:45:33 -04:00
Jim Ferenczi 05915357c9 Set subSearchContext.topDocs after the rescoring in TopDocsAggs
This change fixes a bug introduced in https://github.com/elastic/elasticsearch/pull/20978
The top docs should be set in the subSearchContext after the rescoring
2016-10-21 11:01:17 +02:00
Areek Zillur 4396348e9e fix internal engine unit tests 2016-10-21 01:07:50 -04:00
Areek Zillur dac9856863 Merge branch 'master' into enhancement/replicate_primary_write_failures 2016-10-20 21:49:52 -04:00
Areek Zillur 63c0728292 Simplify TransportWriteAction request handling
This commit reduces classes to handle write
operation results in TransportWriteAction, this
comes at the cost of handling write operations in
TransportShardBulkAction.
Now parsing, mapping failures (which happen before
executing engine write operation) are communicated
via a failure operation type while transient operation
failures are set on the index/delete operations.
2016-10-20 21:22:21 -04:00
Igor Motov 441320b734 Remove cluster.routing.allocation.snapshot.relocation_enabled setting
This experimental setting enables relocation of shards that are being snapshotted, which can cause the shard allocation failures. This setting is undocumented and there is no good reason to set it in production.
2016-10-20 14:19:12 -10:00
Jason Tedor 3c7c8723ff Cleanup load average handling
This commit cleans up the code handling load averages in OsProbe:
 - remove support for BSD; we do not support this OS
 - add Javadocs
 - strengthen assertions and testing
 - add debug logging for exceptional situation

Relates #21037
2016-10-20 15:39:46 -04:00
Ryan Ernst 60353a245a Plugins: Make UnicastHostsProvider extension pull based (#21036)
This change moves providing UnicastHostsProvider for zen discovery to be
pull based, adding a getter in DiscoveryPlugin. A new setting is added,
discovery.zen.hosts_provider, to separate the discovery type from the
hosts provider for zen when it is selected. Unfortunately existing
plugins added ZenDiscovery with their own name in order to just provide
a hosts provider, so there are already many users setting the hosts
provider through discovery.type. This change also includes backcompat,
falling back to discovery.type when discovery.zen.hosts_provider is not
set.
2016-10-20 09:13:59 -07:00
markharwood 4a815bf665 Test fix - configure script object fully before making available. Hopefully a fix for issue 18120 but have been unable to reproduce so cannot confirm. 2016-10-20 14:27:52 +01:00
Jim Ferenczi e04ee40f2c Add specialization of TermsQuery for _type disjunctions 2016-10-20 15:10:45 +02:00
Jim Ferenczi 1b822cc7ef Rescorer should be applied in the TopHits aggregation (#20978)
When using a top hits aggregation the rescorer are ignored.
This change applies the rescorer to the top hits of each bucket.

Fixes #19317
2016-10-20 12:50:49 +02:00
Jim Ferenczi adb30ac091 Max score should be updated when a rescorer is used (#20977)
The max score returned in the response of a query does not take rescorer into account.
This change updates the max_score when a rescorer is used in a query.
Fixes #20651
2016-10-20 12:38:28 +02:00
Jim Ferenczi d0bbe89c16 Optimize query with types filter in the URL (t/t/_search) (#20979)
This change adds a TypesQuery that checks if the disjunction of types should be rewritten to a MatchAllDocs query. The check is done only if the number of terms is below a threshold (16 by default and configurable via max_boolean_clause).
2016-10-20 12:33:32 +02:00
Ryan Ernst 53cff0f00f Move all zen discovery classes into o.e.discovery.zen (#21032)
* Move all zen discovery classes into o.e.discovery.zen

This collapses sub packages of zen into zen. These all had just a couple
classes each, and there is really no reason to have the subpackages.

* fix checkstyle
2016-10-20 00:44:48 -07:00
qwerty4030 95b6f85c87 Fixed date math expression support in multi get requests. (#20659)
Date math index/alias expressions in mget will now be resolved to a concrete single index instead of failing the mget item with an `IndexNotFoundException`.

Added also an integration test to verify multi index aliases do not fail the entire mget request.

Closes #17957
2016-10-20 09:26:55 +02:00
Jason Tedor fb8f1e321d Remove node_info_format parameter from node stats
This commit removes an undocumented output parameter node_info_format
from the cluster stats and node stats APIs. Currently the parameter does
not even work as it is not whitelisted as an output parameter. Since
this parameter is not documented, we opt to just remove it.

Relates #21021
2016-10-19 22:04:35 -04:00
Jason Tedor 7a55cca122 Whitelist node stats indices level parameter
When indices stats are requested via the node stats API, there is a
level parameter to request stats at the index, node, or shards
level. This parameter was not whitelisted when URL parsing was made
strict. This commit whitelists this parameter.

Additionally, there was some leniency in the parsing of this parameter
that has been removed.

Relates #21024
2016-10-19 22:01:17 -04:00
Ryan Ernst e7655bbf80 Remove pluggability of ElectMasterService (#21031)
This change makes the ElectMasterService local to ZenDiscovery, no
longer created by guice, and thus also removes the ability for plugins
to customize. This extension point is no longer used by anything.
2016-10-19 15:04:58 -07:00
Lee Hinman f825988589 Merge remote-tracking branch 'dakrone/readd-force-versioning' 2016-10-19 11:42:08 -06:00
Lee Hinman f4f62ab91c Disallow VersionType.FORCE for 6.0+ indices
This was an error-prone version type that allowed overriding previous
version semantics. It could cause primaries and replicas to be out of
sync however, so it has been removed.

This is related to #20377, which removed the feature entirely. This
allows operations to continue to use the `force` version type if the
index was created before 6.0, in the event a document using it exists in
a translog being replayed.
2016-10-19 11:41:52 -06:00
Colin Goodheart-Smithe 74d8c75d3a Fixes bug preventing script sort working on top_hits aggregation (#21023)
Previous to this change any request using a script sort in a top_hits
aggregation would fail because the compilation of the script happened
after the QueryShardContext was frozen (after we had worked out if the
request is cachable).

This change moves the calling of build() on the SortBuilder to the
TopHitsAggregationBuilder which means that the script in the script_sort
will be compiled before we decide whether to cache the request and freeze
the context.

Closes #21022
2016-10-19 17:51:10 +01:00
Fanfan 043a45746c some misspelled words in code (#21012)
as the title mentioned, misspelling as follows, "construct" to "constrcut", "cumulation" to "cumalation", "initialize" to "intialize".
2016-10-19 11:42:38 -04:00
Jason Tedor 9adc50a6b9 Remove output_uuid parameter from cluster stats
This commit removes an undocumented output parameter output_uuid from
the cluster stats API. Currently the parameter does not even work as it
is not whitelisted as an output parameter. Since the cluster UUID is
available from the main action, and this parameter is not documented, we
opt to just remove it.

Relates #21020
2016-10-19 10:25:13 -04:00
Boaz Leskes 0048ac4536 remove `getMockPlugins` override from IngestProcessorNotInstalledOnAllNodesIT & IngestClientIT
they didn't call the base class and it doesn't seem like they add something/the wrong way to solve a problem.
2016-10-19 11:59:23 +02:00
Ryan Ernst 293a24e8e8 Plugins: Add back user agent when downloading plugins (#20872)
This adds back a User-Agent header, which we had before large plugin
script refactorings for 5.0. The value is now
`elasticsearch-plugin-installer`.
2016-10-18 18:36:16 -07:00
Boaz Leskes c3987156ab Remove local discovery in favor of a simpler `MockZenPings` (#20960)
`LocalDiscovery` is a discovery implementation that uses static in memory maps to keep track of current live nodes. This is used extensively in our tests in order to speed up cluster formation (i.e., shortcut the 3 second ping period used by `ZenDiscovery` by default). This is sad as that mean that most of the test run using a different discovery semantics than what is used in production. Instead of replacing the entire discovery logic, we can use a similar approach to only shortcut the pinging components.
2016-10-18 21:12:15 +02:00
Lee Hinman 2f01f65e1a Add rudimentary logstash and beats template BWC tests (#20588)
This tests that the templates shipped with 5.0 versions of Logstash and
Beats still work on an Elasticsearch 6.0+ node, so that we ensure that
ES can be upgraded prior to upgrading tools dependent on it.

Related to #20491
Resolves #17275
2016-10-18 09:49:09 -06:00
Lee Hinman c1721c6d79 Only negate index expression on all indices with preceding wildcard (#20898)
* Only negate index expression on all indices with preceding wildcard

There is currently a very confusing behavior in Elasticsearch for the
following:

Given the indices: `[test1, test2, -foo1, -foo2]`

```
DELETE /-foo*
```

Will cause the `test1` and `test2` indices to be deleted, when what is
usually intended is to delete the `-foo1` and `-foo2` indices.

Previously we added a change in #20033 to disallow creating indices
starting with `-` or `+`, which will help with this situation. However,
users may have existing indices starting with these characters.

This changes the negation to only take effect in a wildcard (`*`) has
been seen somewhere in the expression, so in order to delete `-foo1` and
`-foo2` the following now works:

```
DELETE /-foo*
```

As well as:

```
DELETE /-foo1,-foo2
```

so in order to actually delete everything except for the "foo" indices
(ie, `test1` and `test2`) a user would now issue:

```
DELETE /*,--foo*
```

Relates to #19800
2016-10-18 17:24:22 +02:00
Jason Tedor 9bb8bd0578 Fix typo in param. name in TransportService method
This commit fixes a typo in a parameter name for the
TransportService#setTracerLogExclude method.

Relates #20970
2016-10-18 10:07:57 -04:00
Fanfan d30de66949 tracelLogExclude to tracerLogExclude (#20970)
fix a variable name for misspelling "tracerLogExclude" to "tracelLogExclude"
2016-10-18 14:22:41 +02:00
Boaz Leskes ba6f759f58 ClusterState publishing shouldn't trigger circuit breakers (#20986)
Updating the circuit breaker settings (and other settings) should always be possible, even if the cluster is under stress. With #20827 we updated the cluster settings request to not trigger circuit breakers. However that change is not complete since the resulting cluster state can potentially not be published. This change makes sure cluster state publishing to not trigger circuit breakers as well.

Relates to #20960 where this was discovered.
2016-10-18 12:57:07 +02:00
Christoph Büscher abff485d68 Use Lucenes expectThrows() when testing exceptions
Cleaning up a few remaining occurences of using junits ExpectedException rule in
favor of using LuceneTestCase#expectThrows() which is more concise and versatile.
2016-10-18 10:34:48 +02:00