Commit Graph

7672 Commits

Author SHA1 Message Date
Tanguy Leroux 1ceb6d04c7 [Test] Fix BulkResponseTests 2017-03-03 09:34:10 +01:00
Jay Modi 01502893eb HTTP transport stashes the ThreadContext instead of the RestController (#23456)
Previously, the RestController would stash the context prior to copying headers. However, there could be deprecation
log messages logged and in turn warning headers being added to the context prior to the stashing of the context. These
headers in the context would then be removed from the request and also leaked back into the calling thread's context.

This change moves the stashing of the context to the HttpTransport so that the network threads' context isn't
accidentally populated with warning headers and to ensure the headers added early on in the RestController are not
excluded from the response.
2017-03-02 14:44:01 -05:00
Ali Beyad 577d2a6a1d Adds cluster state size to /_cluster/state response (#23440)
This commit adds the size of the cluster state to the response for the
get cluster state API call (GET /_cluster/state).  The size that is
returned is the size of the full cluster state in bytes when compressed.
This is the same size of the full cluster state when serialized to
transmit over the network.  Specifying the ?human flag displays the
compressed size in a more human friendly manner.  Note that even if the
cluster state request filters items from the cluster state (so a subset
of the cluster state is returned), the size that is returned is the
compressed size of the entire cluster state.

Closes #3415
2017-03-02 14:20:29 -05:00
Christoph Büscher d02b6f58fa Tests: Adapt ExistsQueryBuilderTests to changes in ExistQueryBuilder#toQuery() (#23462)
Recent changes in the Lucene query that the ExistsQueryBuilder creates broke
this test.
2017-03-02 18:27:30 +01:00
Kunal Kapoor 32d292b3c2 Added types options to DeleteByQueryRequest (#23265)
Add types setter and getter to `DeleteByQueryRequest`, which delegate to the inner `SearchRequest`.
2017-03-02 16:52:21 +01:00
Jim Ferenczi 6519e1207c Fix query_string_query to transform "foo:*" in an exists query on the field name (#23433)
Currently "foo:*" is parsed as prefix query on the field `foo` unless the field is defined in `default_field` or `fields`.
This commit fixes this behavior, "foo:*" is now rewritten to an exists query on the field name.
This change also removes the assumption that "_all:*" should return all docs.

relates #23356
2017-03-02 16:26:27 +01:00
Tanguy Leroux 15c936ec02 Correctly parse BulkItemResponse.Failure's status (#23432)
Today the status is lost when parsing back a BulkItemResponse.Failure. This commit changes the BulkItemResponse.Failure parsing method so that it correctly instantiates a failure with the parsed status instead of realying on the parsed ElasticsearchException (that always return an internal server error status).
2017-03-02 12:37:07 +01:00
Jim Ferenczi 22870cc6c0 Fix centroids equality tests in TDigestState#equals 2017-03-02 11:27:04 +01:00
Tanguy Leroux 5a668c4add Tests: Add unit test for SignificantLongTerms and SignificantStringTerms (#23428)
Relates to #22278
2017-03-02 10:48:29 +01:00
Jim Ferenczi 1228084c1c Fix tests on InternalAggregation that rely on equals/hashCode. 2017-03-02 10:38:16 +01:00
Martijn van Groningen 1d3f6c463c
[INGEST] Added processor type and tag header to error when processor type isn't available on node.
[INGEST] Accumulate any potential other processor parse errors before failing instead of failing upon first processor parsing error.
2017-03-02 08:37:03 +01:00
Nik Everett a54daade33 Tests InternalSingleBucketAggregation subclasses (#23388)
Adds a common base class for testing subclasses of
`InternalSingleBucketAggregation`. They are so similar they
call into question the utility of having all of these classes.
We maybe could just use `InternalSingleBucketAggregation` in
all those cases.... But for now, let's test the classes!

Relates to #22278
2017-03-01 16:50:52 -05:00
Tanguy Leroux e71d9c1960 Tests: Add unit test for InternalDateHistogram (#23402)
Relates to #22278
2017-03-01 16:08:16 +01:00
Adrien Grand 64c90346c6 Avoid adding unnecessary nested filters when ranges are used. (#23427)
The code was testing `PointRangeQuery` however we now use the
`IndexOrDocValuesQuery` in field mappers. This makes the test generate queries
through mappers so that we test the actual queries that would be generated.
2017-03-01 14:34:59 +01:00
Adrien Grand 3134d6b520 Add unit tests to percentile ranks aggregations. (#23240)
Relates #22278
2017-03-01 13:57:40 +01:00
Yannick Welsch c7edaba4e8 [TEST] Fix race condition when blocking cluster state processing during primary relocation
Two tests were periodically failing. What both tests are doing is starting a relocation of a shard from one node to another. Once the
recovery process is started, the test blocks cluster state processing on the relocation target using the BlockClusterStateProcessing disruption. The test then indefinitely
waits for the relocation to complete. The stack dump shows that the relocation is stuck in the PeerRecoveryTargetService.waitForClusterState method, waiting for the relocation target node to have at least the same cluster state
version as the relocation source.

The reason why it gets stuck is the following race:
1) The test code executes a reroute command that relocates a shard from one node to another
2) Relocation target node starts applying the clusterstate with relocation info, starting the recovery process.
4) Recovery is super fast and quickly goes to the waitForClusterState method, which wants to ensure that the cluster state that is
applied on the relocation target is at least as new as the one on the relocation source. The relocation source has already applied the
cluster state but the relocation target is still in the process of applying it. The waitForClusterState method thus uses a
ClusterObserver to wait for the next cluster state. Internally this means submitting a task with priority HIGH to the cluster service.
5) Cluster state application is about to finish on the relocation target. As one of the last steps, it acks to the master which makes the
reroute command return successfully.
6) The test code then blocks cluster state processing on the relocation target by submitting a cluster state update task (with priority
IMMEDIATE) that blocks execution.

If the task that is submitted in step 6 is handled before the one in step 4 by ClusterService's thread executor, cluster state
processing becomes blocked and prevents the cluster state observer from observing the applied cluster state.
2017-03-01 11:55:48 +01:00
Martijn van Groningen 524d7f592d
[TEST] Added unit tests for GeoHashGridAggregator and InternalGeoHashGrid
Part of #22278
2017-03-01 10:33:57 +01:00
Adrien Grand b388389ada Remove support for the include/pattern syntax. (#23141)
Relates #22933
2017-03-01 10:00:38 +01:00
Lee Hinman fd991f32f9 Refactor TransportShardBulkAction and add unit tests
This refactors the `TransportShardBulkAction` to split it appart and make it
unit-testable, and then it also adds unit tests that use these methods.

In particular, this makes `executeBulkItemRequest` shorter and more readable
2017-02-28 19:53:18 -07:00
Jason Tedor 7ce06aeb8c Fix date format in warning headers
This commit fixes the date format in warning headers. There is some
confusion around whether or not RFC 1123 requires two-digit
days. However, the warning header specification very clearly relies on a
format that requires two-digit days. This commit removes the usage of
RFC 1123 date/time format from Java 8, which allows for one-digit days,
in favor of a format that forces two-digit days (it's otherwise
identical to RFC 1123 format, it is just fixed width).

Relates #23418
2017-02-28 20:28:07 -05:00
Ryan Ernst 019263d664 Revert "Internal: Change version constant names for already released versions (#23416)"
This reverts commit dc0e93ed62.
2017-02-28 14:45:13 -08:00
Ryan Ernst dc0e93ed62 Internal: Change version constant names for already released versions (#23416)
We have many version constants in master that have already been
released, but are still marked (by naming convention) as unreleased.
This commit renames those version constants.
2017-02-28 13:05:44 -08:00
Christoph Büscher 98b7023318 Fix checkstyle LineLength issues in UpdateShardAllocationSettingsIT 2017-02-28 20:14:28 +01:00
David Pilato 0ae6bc36fa Create version constants for next bug fix version v5.2.3 2017-02-28 19:11:48 +01:00
Ali Beyad b58eb5f051 [TEST] removes unused SameShardRouting test 2017-02-28 12:58:27 -05:00
Ali Beyad 5e2e45cad9 Makes the same_shard host dyanamically updatable (#23397)
Previously, cluster.routing.allocation.same_shard.host was not a dynamic
setting and could not be updated after startup.  This commit changes the
behavior to allow the setting to be dynamically updatable.  The
documentation already states that the setting is dynamic so no
documentation changes are required.

Closes #22992
2017-02-28 12:48:54 -05:00
Christoph Büscher 5be7f6a76f Tests: fixing line length limit in ScriptedMetricAggregatorTests 2017-02-28 16:56:43 +01:00
Christoph Büscher a522deb6b5 Tests: Add unit test for InternalScriptedMetricAggregator (#23404)
Relates to #22278
2017-02-28 16:43:12 +01:00
Colin Goodheart-Smithe 406d2f7a64
Fixes the per term error in the terms aggregation
When multiple reduce phases were needed the per term error got lost in subsequent reduces in some situations:

When a previous reduce phase had calculated a non-zero error for a particular bucket we were not accounting for this error in subsequent reduce phases and instead were relying on the overall error for the agg which meant we were implicitly assuming that all shards that made up that aggregation had returned the term. This is plainly not true so we need to make sure the per term error for the aggregation is used when calcualting the error for that term in the new reduced aggregation.
2017-02-28 13:56:35 +00:00
Jim Ferenczi 17a0b4e69c Fix merge scheduler test that depends on the number of processors 2017-02-28 11:43:35 +01:00
Jim Ferenczi 0c03d0056c #23391: simplify setting fallback (missing in the squash commit) 2017-02-28 11:34:02 +01:00
Jim Ferenczi d27a55866c Fix merge scheduler config settings (#23391)
Change Setting#get(Settings, Settings) to fallback only if the setting is present in the secondary.
This is needed to fix setting that relies on other settings.
Replace IT with uts.
2017-02-28 10:21:27 +01:00
Christoph Büscher 084cb38207 Tests: Add unit test for InternalScriptedMetric (#23330)
Relates to #22278
2017-02-28 09:40:11 +01:00
Jason Tedor c61cc5f617 Fix deprecation escaping tests
This commit fixes an off-by-one error in the deprecation escaping tests.
2017-02-27 17:19:13 -05:00
Martijn van Groningen 73fb945980
Changed TaskOperationFailure#getCause() return type from Trowable to Exception. 2017-02-27 21:31:19 +01:00
Jim Ferenczi 5c84640126 Upgrade to lucene-6.5.0-snapshot-d00c5ca (#23385)
Lucene upgrade
2017-02-27 18:39:04 +01:00
Jason Tedor 577e6a5e14 Correct warning header to be compliant
The warning header used by Elasticsearch for delivering deprecation
warnings has a specific format (RFC 7234, section 5.5). The format
specifies that the warning header should be of the form

    warn-code warn-agent warn-text [warn-date]

Here, the warn-code is a three-digit code which communicates various
meanings. The warn-agent is a string used to identify the source of the
warning (either a host:port combination, or some other identifier). The
warn-text is quoted string which conveys the semantic meaning of the
warning. The warn-date is an optional quoted date that can be in a few
different formats.

This commit corrects the warning header within Elasticsearch to follow
this specification. We use the warn-code 299 which means a
"miscellaneous persistent warning." For the warn-agent, we use the
version of Elasticsearch that produced the warning. The warn-text is
unchanged from what we deliver today, but is wrapped in quotes as
specified (this is important as a problem that exists today is that
multiple warnings can not be split by comma to obtain the individual
warnings as the warnings might themselves contain commas). For the
warn-date, we use the RFC 1123 format.

Relates #23275
2017-02-27 12:14:21 -05:00
Luca Cavanna 2fb0466f66 Convert suggestion response parsing to use NamedXContentRegistry (#23355)
We recently added parsing code to parse suggesters responses into java api objects. This was done using a switch based on the type of the returned suggestion. We can now replace the switch with using NamedXContentRegistry, which will also be used for aggs parsing.
2017-02-27 15:42:25 +01:00
Colin Goodheart-Smithe 1ceaef0de6
Fixes terms error count for multiple reduce phases
Previously when multiple reduces occured for the terms aggregation we would add up the errors for the aggregations but would not take into account the errors that had already been calculated for the previous reduce phases.

This change corrects that by adding the previously created errors to the new error value.

Closes #23286
2017-02-27 13:44:18 +00:00
javanna 261f31f5b7 [TEST] move filters aggs wrapper query builder rewriting test to integ tests
This test makes little sense when sent from the REST layer, as WrapperQueryBuilder is supposed to be used from the Java api. Also, providing the inner query as base64 string will work only for string formats and break for binary formats like SMILE and CBOR, whcih doesn't play well with randomizing content type in our REST tests
2017-02-27 12:27:03 +01:00
Simon Willnauer b8e2d12b23 Factor out filling of TopDocs in SearchPhaseController (#23380)
Previously this code was duplicated across the 3 different topdocs variants
we have. It also had no real unittest (where we tested with holes in the results)
which caused a sneaky bug where the comparison used `result.size()` vs `results.size()`
causing several NPEs downstream. This change adds a static method to fill the top docs
that is shared across all variants and adds a unittest that would have caught the issue
very quickly.

Closes #19356
Closes #23357
2017-02-27 11:44:41 +01:00
Christoph Büscher 641c88dc29 Prevent negative `from` parameter in SearchSourceBuilder (#23358)
This prevents later errors like the one reported in #23324 and throws an
IllegalArgumentException early instead.
2017-02-27 09:45:10 +01:00
Boaz Leskes 396b8b371c reduce the number of iterations in testPrimaryRelocationWhileIndexing and flush every 5
Without flushing the translog doubles it's size on every recovery
2017-02-26 19:15:33 +01:00
Boaz Leskes 9088ddd09c rollback unneeded change in testNotifyOnDisconnect 2017-02-26 12:30:57 +01:00
Boaz Leskes aa49ba949c disable sampling in testNotifyOnDisconnect
the background activity confuses the test
2017-02-26 12:20:34 +01:00
Ryan Ernst 48548f6c3d CLI: Fix prompting for yes/no to handle console returning null (#23320)
Console.readText may return null in certain cases. This commit fixes a
bug in Terminal.promptYesNo which assumed a non-null return value.  It
also adds a test for this, and modifies mock terminal to be able to
handle null input values.
2017-02-24 20:20:17 -08:00
Ali Beyad 9a9259184a Handle snapshot repository's missing index.latest
If index.latest does not exist, the repository is on an older
version so simply return the empty repository's generation id.
2017-02-24 10:14:22 -05:00
Christoph Büscher 9270f8a873 Adding equals/hashCode to MainResponse (#23352) 2017-02-24 14:58:03 +01:00
Jay Modi 5490cb52b0 Always restore the ThreadContext for operations delayed due to a block (#23349)
The IndexShardOperationsLock has a mechanism to delay operations if there is currently a block on the lock. These
delayed operations are executed when the block is released and are executed by a different thread. When the different
thread executes the operations, the ThreadContext is that of the thread that was blocking operations. In order to
preserve the ThreadContext, we need to store it and wrap the listener when the operation is delayed.
2017-02-24 08:21:04 -05:00
Christoph Büscher b9eb1bba65 Add unit tests for ParentToChildAggregator (#23305)
Adds unit tests for the `children` aggregation.
This change also add the ability to mock Mapperservice in subtests of
AggregatorTestCase.
2017-02-24 10:29:31 +01:00