Commit Graph

8278 Commits

Author SHA1 Message Date
Simon Willnauer b17d23dc99 Obey lock order if working with store to get metadata snapshots (#24787)
Today when we get a metadata snapshot from the index shard we ensure
that if there is no engine started on the shard that we lock the index
writer before we go and fetch the store metadata. Yet, if we concurrently
recover that shard, recovery finalization might fail since it can't acquire
the IW lock on the directory. This is mainly due to the wrong order of aquiring
the IW lock and the metadata lock. Fetching store metadata without a started engine
should block on the metadata lock in Store.java but since IndexShard locks the writer
first we get into a failed recovery dance especially in test. In production
this is less of an issue since we rarely get into this siutation if at all.

Closes #24481
2017-05-19 15:36:39 +02:00
Luca Cavanna 0b8da31ccf SearchResponse#fromXContent to not require START_OBJECT as current token (#24794)
The method should rather advance one token and only then require a START_OBJECT as the current token. This allows to parse given a parser that's at the beginning of the response, where the initial/current token is null.
2017-05-19 15:24:29 +02:00
Tanguy Leroux ad3658a8a3 [Test] Remove ParsedAggregationTests (#24791)
Now the Java High Level Rest Client has tests to parse all aggregations,
 this test is not needed anymore. We have better tests like
 AggregationsTests and sub classes of InternalAggregationTestCase.

 Related to #23965
2017-05-19 13:56:58 +02:00
Christoph Büscher 05acc43505 Fix InternalExtendedStatsTests setUp 2017-05-19 13:37:31 +02:00
Tanguy Leroux 91d7bf474f Remove compareTerm() method in parsed Significant Terms aggregations
This method has been removed in core (see #24714)
2017-05-19 13:20:45 +02:00
Tanguy Leroux 83aa00b3f6 Merge remote-tracking branch 'origin/master' into feature/client_aggs_parsing 2017-05-19 13:13:00 +02:00
Tanguy Leroux 55af1f7a2b [Test] Remove leftover in InternalRangeTests 2017-05-19 13:12:01 +02:00
Tanguy Leroux 4c34ea8fc8 Remove //norelease and cleans up somet aggregations tests (#24789) 2017-05-19 12:46:37 +02:00
Yannick Welsch 7054d24f0d Clear responsibilities for PublishClusterStateAction and ZenDiscovery (#24772)
This commit moves some functionality from PublishClusterStateAction to ZenDiscovery, which allows each class to focus on it's core competencies:
- PendingStatesQueue is now solely managed by ZenDiscovery (no shared access by both PublishClusterStateAction and ZenDiscovery)
- Validation logic is handled exclusively by ZenDiscovery
2017-05-19 09:34:23 +02:00
Jack Conradson 1196dfb6bb Remove Deprecated Script Settings (#24756)
Removes all fine-grained script settings replaced by scripts.types_allowed and scripts.contexts_allowed.
2017-05-18 13:32:46 -07:00
Jason Tedor fe83df2a50 Refactor update shard logic for primaries
This commit is a simple refactoring of the update shard logic for
primaries. Namely, there was some duplicated code here that was annoying
to have to read twice so it is now collapsed with this commit.
2017-05-18 15:15:45 -04:00
Boaz Leskes 3d5154191c TransportShardBulkAction: s/tha that/that/ 2017-05-18 21:15:17 +02:00
Boaz Leskes ff374f1d0d TransportShardBulkAction: remove hard version assertion and improve todo comment
We have decided not to force a future version upgrade to deal with this todo. Rather, we'll keep the code until its in our way / the opportunity arises to deal with it.
2017-05-18 20:59:08 +02:00
Nik Everett 82d2c7a142 Remove vagrant testing versions (#24754)
Now that we generate the versions list from Versions.java we can
drop the list of versions maintained for vagrant testing. One nice
thing that the vagrant testing did was to check if the list of
versions was out of date. This moves that test to the core
project.
2017-05-18 09:33:13 -04:00
Tanguy Leroux 96dac4c670 Remove the unused SignificantTerms.compareTerm() method (#24714)
This method is not used and not tested. While it exists it forces
implementations of the interface to implement it while it's unused.
2017-05-18 14:57:12 +02:00
Koen De Groote 905eb422f6 Use StringBuilder to construct a String instead of relying on appending where possible (#24753)
This PR revolves around places in the code where introducing a StringBuilder might make the construction
of a String easier to follow and also, maybe avoid a case where the compiler's very safe way of introducing 
StringBuilder instead of String might not always be optimal for performance.
2017-05-18 12:02:29 +02:00
Simon Willnauer 831c497638 [TEST] Fix compatibilty tests for wire compatibility based on Version.java 2017-05-18 11:21:50 +02:00
Christoph Büscher f658a8d137 DateHistogram: Fix 'extended_bounds' with 'offset' (#23789)
This fixes a bug in the 'date_histogram' aggregation that can happen when using 'extended_bounds'
together with some 'offset' parameter. Offsets should be applied after rounding the extended bounds 
and also be applied when adding empty buckets during the reduce phase in InternalDateHistogram.

Closes #23776
2017-05-18 11:07:48 +02:00
Tanguy Leroux eeef2e6c31 Merge remote-tracking branch 'origin/master' into feature/client_aggs_parsing 2017-05-18 09:43:57 +02:00
Tanguy Leroux f10391e16e Fix checkstyle violation in ParsedScriptedMetric 2017-05-18 09:41:04 +02:00
Tanguy Leroux 055875392e Add parsing method for Top Hits aggregation (#24717)
Related to #23331
2017-05-18 09:37:46 +02:00
Tanguy Leroux 25fceb8c0f Add parsing method for binary range aggregation (#24706)
Related to #23331
2017-05-18 09:24:33 +02:00
Koen De Groote d744d77f61 Fix String concatenation within a StringBuilder append chain
This commit replaces String concatenation within a StringBuilder append chain by using explicit append calls.
2017-05-18 08:51:30 +02:00
Ryan Ernst 26e2e933f5 Scripting: Remove native scripts (#24726)
Native scripts have been replaced in documentation by implementing
a ScriptEngine and they were deprecated in 5.5.0. This commit
removes the native script infrastructure for 6.0.

closes #19966
2017-05-17 14:49:24 -07:00
Ryan Ernst 463fe2f4d4 Scripting: Remove file scripts (#24627)
This commit removes file scripts, which were deprecated in 5.5.

closes #21798
2017-05-17 14:42:25 -07:00
Ryan Ernst f8a48badcf Settings: Remove shared setting property (#24728)
Shared settings were added intially to allow the few common settings
names across aws plugins. However, in 6.0 these settings have been
removed. The last use was in netty, but since 6.0 also has the netty 3
modules removed, there is no longer a need for the shared property. This
commit removes the shared setting property.
2017-05-17 13:14:12 -07:00
Luca Cavanna da669f0554 Add fromXContent method to SearchResponse (#24720)
SearchResponse#fromXContent allows to parse a search response, including search hits, aggregations, suggestions and profile results. Only the aggs that we can parse today are supported (which means all of them but a couple that are left to support). SearchResponseTests reuses the existing test infra to randomize aggregations, suggestions and profile response.

Relates to #23331
2017-05-17 20:28:33 +02:00
Jay Modi 7ce0b1b7c6 Allow SearchOperationListeners to validate a search context (#24650)
This commit adds a new method to the SearchOperationListener that allows implementers to validate
the SearchContext immediately after it is retrieved from the active contexts. The listener may
throw a runtime exception if it deems the SearchContext is not valid and that the use of the context
should be terminated.
2017-05-17 13:07:57 -04:00
Lee Hinman 01bcbd868d [TEST] Fix TransportReplicationActionTests.testRetryOnReplica for replica request (#24745)
* [TEST] Fix TransportReplicationActionTests.testRetryOnReplica for replica request

We were improperly testing that it was a `ConcreteShardRequest` instead of a
`ConcreteReplicaRequest`. This adds that change and also ensures that the
checkpoint is retrievable from the request.

* Fix line-length
2017-05-17 10:58:50 -06:00
Christoph Büscher 9fc9db26fd Add parsing for InternalScriptedMetric aggregation (#24738) 2017-05-17 18:55:57 +02:00
javanna ce7326eb88 Merge branch 'master' into feature/client_aggs_parsing 2017-05-17 17:59:00 +02:00
Simon Willnauer 2ccc223ff7 Fix Version based BWC and set correct minCompatVersion (#24732)
Approaching the release of 6.0 we need to sort out the usage of
`Version#minimumCompatibilityVersion` which was still set to 5.0.0.
Now this change moves it to the latest released version of 5.x (5.4 at this point)
to ensure we are compatible with the latest minor of the previous major. This change
also removes all the `_UNRELEASED` from the versions that where released and drops versions
that were never released and are not expected to be released (bugfixes in minors that are not
the latest in the previous major).
2017-05-17 17:27:09 +02:00
Nik Everett f56d8676cf Fix GetTermVectorsIT
It was assuming that payloads were available in a context where
they weren't.

Relates to #24716
2017-05-17 09:32:07 -04:00
Jim Ferenczi 67c41d2e77 Fix ExpandSearchPhase when response contains no hits (#24688)
This change skips the expand search phase entirely when there is no search hits in the response.
2017-05-17 14:15:40 +02:00
Simon Willnauer cf846af0e5 Fix `_field_caps` serialization in order to support cross cluster search (#24722)
Today the `_field_caps` API doesn't implement its request serialization
correctly since indices and indices options are not serialized at all.
This will likely break with all transport clients etc. and if this request
must be send across the network. This commit fixes this and adds correct
handling if we have only remote indices to prevent the inclusion of
all local indices.
2017-05-17 14:02:45 +02:00
George Papadrosou 8a4d8909a1 Fix ArrayIndexOutOfBoundsException when no ranges are specified in the query (#23241)
* Fix ArrayIndexOutOfBoundsException in Range Aggregation when no ranges are specified in the query

* Revert "Fix ArrayIndexOutOfBoundsException in Range Aggregation when no ranges are specified in the query"

This reverts commit ad57d8feb3577a64b37de28c6f3df96a3a49fe93.

* Fix range aggregation out of bounds exception when there are no ranges in a range or date_range query

* Fix range aggregation out of bounds exception when there are no ranges in the query

This fix is applied to range queries, date range queries, ip range queries and geo distance aggregation queries
2017-05-17 10:34:01 +01:00
Simon Willnauer 11ea588aee Move BWC versin to 5.5 after backport
Relates to #24678
2017-05-16 21:01:19 +02:00
Ryan Ernst 25dd64497b Scripting: Deprecate native scripts (#24692)
Native scripts are no longer documented and instead using a ScriptEngine
is recommended. This change adds a deprecation warning for removal in
6.0.

relates #19966
2017-05-16 11:57:18 -07:00
Lee Hinman d09e64323f Add ability to automatically adjust search threadpool queue_size
This PR adds a new thread pool type: `fixed_auto_queue_size`. This thread pool
behaves like a regular `fixed` threadpool, except that every
`auto_queue_frame_size` operations (default: 10,000) in the thread pool,
[Little's Law](https://en.wikipedia.org/wiki/Little's_law) is calculated and
used to adjust the pool's `queue_size` either up or down by 50. A minimum and
maximum is taken into account also. When the min and max are the same value, a
regular fixed executor is used instead.

The `SEARCH` threadpool is changed to use this new type of thread pool. However,
the min and max are both set to 1000, meaning auto adjustment is opt-in rather
than opt-out.

Resolves #3890
2017-05-16 11:13:16 -06:00
Nik Everett 7ef390068a Move remaining pre-configured token filters into analysis-common (#24716)
Moves the remaining preconfigured token figured into the analysis-common module. There were a couple of tests in core that depended on the pre-configured token filters so I had to touch them:

* `GetTermVectorsCheckDocFreqIT` depended on `type_as_payload` but didn't do anything important with it. I dropped the dependency. Then I moved the test to a single node test case because we're trying to cut down on the number of `ESIntegTestCase` subclasses.
* `AbstractTermVectorsTestCase` and its subclasses depended on `type_as_payload`. I dropped their usage of the token filter and added an integration test for the termvectors API that uses `type_as_payload` to the `analysis-common` module.
* `AnalysisModuleTests` expected a few pre-configured token filtes be registered by default. They aren't any more so I dropped this assertion. We assert that the `CommonAnalysisPlugin` registers these pre-built token filters in `CommonAnalysisFactoryTests`
* `SearchQueryIT` and `SuggestSearchIT` had tests that depended on the specific behavior of the token filters so I moved the tests to integration tests in `analysis-common`.
2017-05-16 13:10:24 -04:00
Jason Tedor a00165913b Adjust comment lengths in IndexShard
This commit adjusts the length of some comments in IndexShard.java that
were written when the column width was set to 100.
2017-05-16 12:26:07 -04:00
Ryan Ernst 97d2657e18 Remove script access to term statistics (#19462)
In scripts (at least some of the languages), the terms dictionary and
postings can be access with the special _index variable. This is for
very advanced use cases which want to do their own scoring. The problem
is segment level statistics must be recomputed for every document.
Additionally, this is not friendly to the terms index caching as the
order of looking up terms should be controlled by lucene.

This change removes _index from scripts. Anyone using it can and should
instead write a Similarity plugin, which is explicitly designed to allow
doing the calculations needed for a relevance score.

closes #19359
2017-05-16 09:10:09 -07:00
Simon Willnauer 1cae850cf5 Add a cluster block that allows to delete indices that are read-only (#24678)
Today when an index is `read-only` the index is also blocked from
being deleted which sometimes is undesired since in-order to make
changes to a cluster indices must be deleted to free up space. This is
a likely scenario in a hosted environment when disk-space is limited to switch
indices read-only but allow deletions to free up space.
2017-05-16 17:34:37 +02:00
Simon Willnauer 65218fea6d Allow resetting settings that use and IP validator (#24713)
The IP validator doesn't expect a null value for a setting that causes NPEs
if a user tries to reset a setting that uses this validator.

Closes #24709
2017-05-16 16:06:24 +02:00
Zachary Tong 1e97184519 Automatically close releasables after test (#24687)
This moves the releasing logic to the base test, so that individual test cases don't need
to worry about releasing the aggregators.  It's not a big deal for individual aggs,
but once tests start using sub-aggs, it can become tricky to free (without double-freeing)
all the aggregators.
2017-05-16 09:01:38 -04:00
Tanguy Leroux d5fc520741 Add parsing to Significant Terms aggregations (#24682)
Related to  #23331
2017-05-16 14:54:42 +02:00
Christoph Büscher ef7c2e62c3 Add parsing for InternalAdjacencyMatrix aggregation (#24700) 2017-05-16 14:35:49 +02:00
Martijn van Groningen f6e19dcedc
percolator: Fix range queries with date range based on current time.
Range queries with now based date ranges were previously not allowed,
but since #23921 these queries were allowed. This change should really
fix range queries with now based date ranges.
2017-05-16 13:13:11 +02:00
Christoph Büscher 059b23e92e Merge branch 'master' into feature/client_aggs_parsing 2017-05-16 11:54:02 +02:00
Christoph Büscher 8c6b5a953e [Tests] Add unit test for InternalAdjecencyMatrix aggregation (#24698)
Adding a unit test to InternalAdjecencyMatrix that extends the shared InternalAggregationTestCase
 that we use for testing aggregations.
Relates to #22278
2017-05-16 11:51:45 +02:00
Boaz Leskes a474a13911 testRerouteRecovery should use assertBusy when checking recovery counters
The test check that the number of outgoing/incoming recoveries of a shard is 0 after recoveries were done. Sadly that is not guaranteed by the current recovery logic as we decrement the counters only when all references to the relevant RecoveryTarget object have been released. This may happen in an async fashion to the recovery completion which causes the test to fail. I looked at options to change the recovery logic to have the recovery counters decrease before the recovery is done *under normally circumstances* but I don't see a clean way to do it. Since it won't give hard guarantees anyway I opted to add assertBusy to the test

Closes #24669
2017-05-16 11:09:52 +02:00
Ryan Ernst d966034298 Scripting: Deprecate index lookup (#24691)
This commit adds a deprecation warning if `_index` is used in scripts.
It is emitted each time a script is invoked, but not per document. There
is no test because constructing a LeafIndexLookup is quite difficult,
but the deprecation warning does show up in IndexLookupIT, there is just
no way to assert warnings in integ tests.

relates #19359
2017-05-16 01:41:29 -07:00
Simon Willnauer f9cfe86320 Make RemoteClusterConnectionTests more robust against cancelable threads aborts
Today we assert hart if failure listeners are invoked more than once. Yet, this
can happen if we cancel the execution since the caller and the handler will get
the exception on the cancelable threads and will notify the listener concurrently
if timinig allows. This commit relaxes the assertion towards handling multiple
invocations with `ExecutionCancelledException`

Closes #24010
Closes #24179
Closes vagnerclementino/elasticsearch/#98
2017-05-16 10:01:17 +02:00
Ryan Ernst 6ce597a378 Scripts: Convert template script engines to return String instead of BytesReference (#24447)
Template script engines (mustache, the only one) currently return a
BytesReference that users must know is utf8 encoded. This commit
modifies all callers and mustache to have the template engine return
String. This is much simpler, and does not require decoding in order to
use (for example, in ingest).
2017-05-15 22:37:31 -07:00
Jack Conradson 43292979fd Add New Security Script Settings (#24637)
Settings are simplified to allowed_types and allowed_contexts.  If a setting is not specified the default is to enable all for that setting.
2017-05-15 13:37:46 -07:00
Igor Motov 243635222a Move ReindexAction class to core (#24684)
This class is also needed for plugins to use reindex functionality.

Relates to #24578
2017-05-15 14:28:59 -04:00
Luca Cavanna 563e7ddc83 Pass over _routing value with more_like_this items to be retrieved (#24679)
When retrieving documents to extract terms from as part of a more like this query, the _routing value can be set, yet it gets lost. That leads to not being able to retrieve the documents, hence more_like_this used to return no matches all the time.

Closes #23699
2017-05-15 18:15:42 +02:00
Luca Cavanna e14ba81ac1 Make ObjectParser support string to boolean conversion (#24668)
We generally accept string values when a boolean is expected. We've been doing that in our parsing code, but we missed that bit when moving parsing code to ObjectParser, which throws an error instead. This commit makes ObjectParser parse also string values into booleans. It throws an error in case the value is not `true` or `false`.

Closes #21802
2017-05-15 18:15:20 +02:00
Tanguy Leroux 5fb04fa603 Merge remote-tracking branch 'origin/master' into feature/client_aggs_parsing 2017-05-15 17:08:26 +02:00
Tanguy Leroux dcb63ab8bc Share XContent rendering code in significant terms aggregations (#24677)
The rendering methods in String and Long Significant String aggregations
 and buckets are very similar. They can be factored out in the
 InternalSignificantTerms class an InternalMappedSignificantTerms class.
2017-05-15 16:52:02 +02:00
Christoph Büscher 60505c9100 Add parsing for InternalFilters aggregation (#24648)
This adds parsing to the InternalFilters aggregation.
2017-05-15 15:26:35 +02:00
Tanguy Leroux 578223f679 Make SignificantTerms.Bucket an interface rather than an abstract class (#24670)
This commit changes SignificantTerms.Bucket so that it is not an
abstract class anymore but an interface. It will be easier for the Java
High Level Rest Client to provide its own implementation of
SignificantTerms and SignificantTerms.Bucket. Also, it is now more
coherent with the others aggregations.
2017-05-15 15:14:07 +02:00
Christoph Büscher 0b688a8733 Small improvement in InternalAggregationTestCase test setup after changes in master (#24675) 2017-05-15 15:06:01 +02:00
Jason Tedor bd5aee8cfa Split disruption test suite
The disruption tests sit in a single test suite which causes these tests
to be single-threaded. We can split this test suite into multiple suites
(logically, of course) enabling them to be run in parallel reducing the
total run time of all integration tests in core. This commit splits the
discovery with service disruptions test suite into three suites
 - master disruptions
 - discovery disruptions
 - cluster disruptions

The last one could probably be better named, it is meant to represent
performing actions in the cluster (indexing, failing a shard, etc.)
while a disruption is taking place.

Relates #24662
2017-05-15 07:47:42 -04:00
Christoph Büscher 42e8d4b761 Merge branch 'master' into feature/client_aggs_parsing
Conflicts:
	core/src/test/java/org/elasticsearch/search/aggregations/bucket/filter/InternalFilterTests.java
	core/src/test/java/org/elasticsearch/search/aggregations/bucket/global/InternalGlobalTests.java
	core/src/test/java/org/elasticsearch/search/aggregations/bucket/missing/InternalMissingTests.java
	core/src/test/java/org/elasticsearch/search/aggregations/bucket/nested/InternalNestedTests.java
	core/src/test/java/org/elasticsearch/search/aggregations/bucket/nested/InternalReverseNestedTests.java
	core/src/test/java/org/elasticsearch/search/aggregations/bucket/sampler/InternalSamplerTests.java
	modules/parent-join/src/test/java/org/elasticsearch/join/aggregations/InternalChildrenTests.java
	test/framework/src/main/java/org/elasticsearch/search/aggregations/InternalSingleBucketAggregationTestCase.java
2017-05-15 12:25:07 +02:00
Christoph Büscher bb59ee51b0 Revert changing the InternalSampler type constant (#24667) 2017-05-15 11:49:47 +02:00
Kunal Kapoor fdb6cd8088 Deprecate use of + in index names (#24585)
Use of '+' in index names is implicit. There is no need to support it. This commit deprecates support for it.

Closes #24515
2017-05-15 11:26:51 +02:00
Koen De Groote f185b69e04 Replace manual copying an array or collection with static methods calls (#24657) 2017-05-15 09:35:48 +02:00
Ryan Ernst 17f8d2debd Settings: Remove support for yaml and json config files (#24664)
This commit removes the deprecated support for .yaml and .json files. If
the files still exist, the node will fail to start, indicating the file
must be converted or renamed.

closes #19391
2017-05-14 17:45:04 -07:00
Ryan Ernst e6535bc771 Settings: Update settings deprecation from yml to yaml (#24663)
This converts the deprecation added for 5.5 from .yml to .yaml. Note
that this deprecation has not been released yet.

relates #19391
2017-05-14 17:40:50 -07:00
Tanguy Leroux b9d2ecc3ea Add parsing methods to Range aggregations (#24583) 2017-05-12 16:52:47 +02:00
Tanguy Leroux f8df2a22e9 SniffNodesSampler should close connection after handling responses (#24632)
With the current implementation, SniffNodesSampler might close the
current connection right after a request is sent but before the response
is correctly handled. This causes to timeouts in the transport client
when the sniffing is activated.

closes #24575
closes #24557
2017-05-12 16:38:50 +02:00
Koen De Groote 878ae8eb3c Size lists in advance when known
When constructing an array list, if we know the size of the list in
advance (because we are adding objects to it derived from another list),
we should size the array list to the appropriate capacity in advance (to
avoid resizing allocations). This commit does this in various places.

Relates #24439
2017-05-12 10:36:13 -04:00
Simon Willnauer e8e2ccdcf5 Call onClose listener in a finally block 2017-05-12 16:32:29 +02:00
Jim Ferenczi 279a18a527 Add parent-join module (#24638)
* Add parent-join module

This change adds a new module named `parent-join`.
The goal of this module is to provide a replacement for the `_parent` field but as a first step this change only moves the `has_child`, `has_parent` queries and the `children` aggregation to this module.
These queries and aggregations are no longer in core but they are deployed by default as a module.

Relates #20257
2017-05-12 15:58:06 +02:00
Tanguy Leroux 29a5694bb7 Add parsing method to GeoHashGrid aggregation (#24589) 2017-05-12 15:44:39 +02:00
Simon Willnauer be2a6ce80b Notify onConnectionClosed rather than onNodeDisconnect to prune transport handlers (#24639)
Today we prune transport handlers in TransportService when a node is disconnected.
This can cause connections to starve in the TransportService if the connection is
opened as a short living connection ie. without sharing the connection to a node
via registering in the transport itself. This change now moves to pruning based
on the connections cache key to ensure we notify handlers as soon as the connection
is closed for all connections not just for registered connections.

Relates to #24632
Relates to #24575
Relates to #24557
2017-05-12 15:40:40 +02:00
Yannick Welsch 04e08f5e49 Simplify Discovery interface (#24608)
- Removes clusterState, getInitialClusterState and getMinimumMasterNodes methods from Discovery interface.
- Sets PingContextProvider in ZenPing constructor
- Renames state in ZenDiscovery to committedState
2017-05-12 14:08:14 +02:00
Christoph Büscher ee1303a9fc Merge branch 'master' into feature/client_aggs_parsing 2017-05-12 11:53:38 +02:00
Christoph Büscher f06467b6a0 [Tests] Add unit tests for InternalFilters (#24624)
Relates to #22278
2017-05-12 11:48:44 +02:00
Christoph Büscher 744b1afcb2 Merge branch 'master' into feature/client_aggs_parsing
Conflicts:
	core/src/test/java/org/elasticsearch/search/aggregations/bucket/histogram/InternalHistogramTests.java
	core/src/test/java/org/elasticsearch/search/aggregations/bucket/terms/DoubleTermsTests.java
	core/src/test/java/org/elasticsearch/search/aggregations/bucket/terms/LongTermsTests.java
	core/src/test/java/org/elasticsearch/search/aggregations/bucket/terms/StringTermsTests.java
2017-05-12 10:55:05 +02:00
Byron Voorbach 70e14d5e3f Fix Source filtering in new field collapsing feature
Update ValueType of FetchSourceContext to OBJECT_ARRAY_BOOLEAN_OR_STRING to be in line with other source_filtering implementations
2017-05-12 09:38:16 +02:00
Koen De Groote 220bd2de6e Make a few class level fields static
This commit converts some final constant instance fields to class
fields.
2017-05-11 22:44:31 -04:00
Ryan Ernst f477a6472d Settings: Deprecate settings in .yml and .json (#24059)
This commit adds a deprecation warning when elasticsearch.yml or
elasticsearch.json is read during startup.

relates #19391
2017-05-11 13:11:18 -07:00
Ryan Ernst c1f1f66509 Scripting: Replace advanced and native scripts with ScriptEngine docs (#24603)
This commit documents how to write a `ScriptEngine` in order to use
expert internal apis, such as using Lucene directly to find index term
statistics. These documents prepare the way to remove both native
scripts and IndexLookup.

The example java code is actually compiled and tested under a new gradle
subproject for example plugins. This change does not yet breakup
jvm-example into the new examples dir, which should be done separately.

relates #19359
relates #19966
2017-05-11 12:15:16 -07:00
Ryan Ernst 17d01550c2 S3 Repository: Add back repository level credentials (#24609)
Specifying s3 access and secret keys inside repository settings are not
secure. However, until there is a way to dynamically update secure
settings, this is the only way to dynamically add repositories with
credentials that are not known at node startup time. This commit adds
back `access_key` and `secret_key` s3 repository settings, but protects
it with a required system property `allow_insecure_settings`.
2017-05-11 12:14:23 -07:00
Simon Willnauer 1155615536 Move DeleteByQuery and Reindex requests into core (#24578)
This allows other plugins to use a client to call the functionality
that is in the core modules without duplicating the logic.
Plugins can now safely send the request and response classes via the
client even if the requests are executed locally. All relevant classes
are loaded by the core classloader such that plugins can share them.

This is re-adds this commit that was revered in 952feb58e4
2017-05-11 20:22:30 +02:00
Jason Tedor 657686cefb Fix runtime class cast exception in TRA
If we fail to acquire the shard lock, need to retry and wait for the new
cluster state, we were sending the wrong kind of request for the replica
action. This commit fixes this issue.
2017-05-11 13:58:03 -04:00
qwerty4030 e7d352b489 Compound order for histogram aggregations. (#22343)
This commit adds support for histogram and date_histogram agg compound order by refactoring and reusing terms agg order code. The major change is that the Terms.Order and Histogram.Order classes have been replaced/refactored into a new class BucketOrder. This is a breaking change for the Java Transport API. For backward compatibility with previous ES versions the (date)histogram compound order will use the first order. Also the _term and _time aggregation order keys have been deprecated; replaced by _key.

Relates to #20003: now that all these aggregations use the same order code, it should be easier to move validation to parse time (as a follow up PR).

Relates to #14771: histogram and date_histogram aggregation order will now be validated at reduce time.

Closes #23613: if a single BucketOrder that is not a tie-breaker is added with the Java Transport API, it will be converted into a CompoundOrder with a tie-breaker.
2017-05-11 18:06:26 +01:00
Simon Willnauer 952feb58e4 Revert "Move DeleteByQuery and Reindex requests into core (#24578)"
This reverts commit 6ea2ae32b8.
2017-05-11 18:26:40 +02:00
Lee Hinman 57fddce8c4 [TEST] Use at least 1ms for FunctionScoreQueryBuilderTests
Previously micros or nanoseconds could be used, which was reduced to 0
milliseconds and `scale` must be higher than 0.
2017-05-11 10:10:55 -06:00
Jason Tedor d9cac191a2 Fix missing active IDs prevent advance test
This commit addresses an issue in the missing active IDs prevent advance
test from the global checkpoint tracker. The assumptions this test was
making about reality were violated when global checkpoints were inlined
(specifically, the component of that change where the tracker's
knowledge of the global checkpoint was updated inline with updates to
the tracker's knowledge of local checkpoints for an allocatio ID). The
point of the test was to ensure that a lagging shard prevents the global
checkpoint from advancing, so this commit rewrites the test with that in
mind.
2017-05-11 11:39:33 -04:00
Simon Willnauer 6ea2ae32b8 Move DeleteByQuery and Reindex requests into core (#24578)
This allows other plugins to use a client to call the functionality
that is in the core modules without duplicating the logic.
Plugins can now safely send the request and response classes via the
client even if the requests are executed locally. All relevant classes
are loaded by the core classloader such that plugins can share them.
2017-05-11 16:20:40 +02:00
Simon Willnauer 8f798f1231 Add up-to-date javadocs on Translog#syncNeeded 2017-05-11 15:28:39 +02:00
Simon Willnauer 64d0d9184d Fix IndexShardIT#testDurableFlagHasEffect to only test if operations have been synced
With global checkpoints we also take into account if a global checkpoint must be fsynced.
Yet, with recent addition of inlining global checkpoints into indexing operations from a
test perspective unnecessary fsyncs might be reported if `Translog#syncNeeded` is checked.
Now the test only check if the last write location triggers an fsync instead.

Closes #24600
2017-05-11 15:13:09 +02:00
Jason Tedor b6cb9a4e8a Fix checkpoints advance test
This commit fixes an issue in the checkpoints advance test. Namely, when
there zero documents indexed, after the global checkpoint is synced, the
global checkpoint will have advanced to the no ops performed. There is a
larger conceptual problem here, namely that the primary does not update
its knowledge of its own local checkpoint upon recovery which causes the
global checkpoint to initially be unassigned and then advance to no ops
performed, but this will be addressed in a follow-up.
2017-05-11 07:25:11 -04:00
Christoph Büscher c4fc8edc03 Add parsing for single bucket aggregations (#24564)
This adds parsing to all implementations of SingleBucketAggregations. They are mostly similar, so they share the common
base class `ParsedSingleBucketAggregation` and the shared base test `InternalSingleBucketAggregationTestCase`.
2017-05-11 11:50:35 +02:00
Martijn van Groningen e5b42bed50
inner_hits: Reuse inner hit query weight
Previously query weight was created for each search hit that needed to compute inner hits,
 with this change the weight of the inner hit query is computed once for all search hits.

Closes #23917
2017-05-11 11:48:13 +02:00
Christoph Büscher 570390ac36 Merge branch 'master' into feature/client_aggs_parsing 2017-05-11 11:20:39 +02:00
Jim Ferenczi e13db1b269 Validates updated settings on closed indices (#24487)
We allow non-dynamic settings to be updated on closed indices but we don't
check if the updated settings can be used to open/create the index.
This can lead to unrecoverable state where the settings are updated but the index
cannot be reopened since the settings are not valid. Trying to update the invalid settings
is also not possible since the update will fail to validate the current settings.
This change adds the validation of the updated settings for closed indices and make sure that the new settings
do not prevent the reopen of the index.

Fixes #23787
2017-05-11 11:06:55 +02:00
Ali Beyad bc223b6aef Removes completed snapshot from cluster state on master change (#24605)
Previously, if a master node updated the cluster state to reflect that a
snapshot is completed, but subsequently failed before processing a
cluster state to remove the snapshot from the cluster state, then the
newly elected master would not know that it needed to clean up the
leftover cluster state.

This commit ensures that the newly elected master sees if there is a
snapshot in the cluster state that is in the completed state but has not
yet been removed from the cluster state.

Closes #24452
2017-05-10 23:08:59 -04:00
Nik Everett 65f2717ab7 Make PreConfiguredTokenFilter harder to misuse (#24572)
There are now three public static method to build instances of
PreConfiguredTokenFilter and the ctor is private. I chose static
methods instead of constructors because those allow us to change
out the implementation returned if we so desire.

Relates to #23658
2017-05-10 22:39:43 -04:00
Jason Tedor 0b089ac084 Refresh at end of concurrent relocate test
We have to do something to force the global checkpoint to be
synchronized to the replicas or the assertions at the end of the test
that they are in sync will trip. Since the last write operation to hit a
replica shard will only carry the penultimate global checkpoint (it will
advance when the replicas respond with their local checkpoint), and a
background sync will not happen until the primary shard falls idle, we
force a sync through a refresh action.
2017-05-10 18:54:22 -04:00
Jack Conradson 349d1bd23e Fixes ScriptServiceTests.testDefaultBehaviourFineGrainedSettings due to
an error with the fine grained settings deprecation.
2017-05-10 15:00:29 -07:00
Ali Beyad 63a408a128 Updates version for get snapshot API with verbose option to 5.5 2017-05-10 17:38:23 -04:00
Jack Conradson 6ac8a1eb85 Deprecate Fine Grain Settings for Scripts (#24573) 2017-05-10 13:09:31 -07:00
Ali Beyad 743217a430 Enhances get snapshots API to allow retrieving repository index only (#24477)
Currently, the get snapshots API (e.g. /_snapshot/{repositoryName}/_all)
provides information about snapshots in the repository, including the
snapshot state, number of shards snapshotted, failures, etc.  In order
to provide information about each snapshot in the repository, the call
must read the snapshot metadata blob (`snap-{snapshot_uuid}.dat`) for
every snapshot.  In cloud-based repositories, this can be expensive,
both from a cost and performance perspective.  Sometimes, all the user
wants is to retrieve all the names/uuids of each snapshot, and the
indices that went into each snapshot, without any of the other status
information about the snapshot.  This minimal information can be
retrieved from the repository index blob (`index-N`) without needing to
read each snapshot metadata blob.

This commit enhances the get snapshots API with an optional `verbose`
parameter.  If `verbose` is set to false on the request, then the get
snapshots API will only retrieve the minimal information about each
snapshot (the name, uuid, and indices in the snapshot), and only read
this information from the repository index blob, thereby giving users
the option to retrieve the snapshots in a repository in a more
cost-effective and efficient manner.

Closes #24288
2017-05-10 15:48:40 -04:00
Jason Tedor fbf532a626 Revert "Add global checkpoint assertion in index shard"
This reverts commit 89b305c09e.
2017-05-10 14:28:07 -04:00
Lee Hinman d2c69701e6 Fix SocketPermission in test framework for alpha2 bump
It was using the wrong version, which can cause errors like

```
  1> java.security.AccessControlException: access denied ("java.net.SocketPermission" "[0:0:0:0:0:0:0:1]:34221" "connect,resolve")
  1> 	at java.security.AccessControlContext.checkPermission(AccessControlContext.java:472) ~[?:1.8.0_111]
  1> 	at java.security.AccessController.checkPermission(AccessController.java:884) ~[?:1.8.0_111]
  1> 	at java.lang.SecurityManager.checkPermission(SecurityManager.java:549) ~[?:1.8.0_111]
  1> 	at java.lang.SecurityManager.checkConnect(SecurityManager.java:1051) ~[?:1.8.0_111]
  1> 	at sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:625) ~[?:?]
  1> 	at org.apache.http.impl.nio.reactor.DefaultConnectingIOReactor.processSessionRequests(DefaultConnectingIOReactor.java:273) ~[httpcore-nio-4.4.5.jar:4.4.5]
  1> 	at org.apache.http.impl.nio.reactor.DefaultConnectingIOReactor.processEvents(DefaultConnectingIOReactor.java:139) ~[httpcore-nio-4.4.5.jar:4.4.5]
  1> 	at org.apache.http.impl.nio.reactor.AbstractMultiworkerIOReactor.execute(AbstractMultiworkerIOReactor.java:348) ~[httpcore-nio-4.4.5.jar:4.4.5]
  1> 	at org.apache.http.impl.nio.conn.PoolingNHttpClientConnectionManager.execute(PoolingNHttpClientConnectionManager.java:192) ~[httpasyncclient-4.1.2.jar:4.1.2]
1> at org.apache.http.impl.nio.client.CloseableHttpAsyncClientBase$1.run(CloseableHttpAsyncClientBase.java:64) ~[httpasyncclient-4.1.2.jar:4.1.2]
```

When running tests
2017-05-10 11:27:57 -06:00
Christoph Büscher ae5919e5df Tests: Fix VersionTests after version bump 2017-05-10 18:18:22 +02:00
javanna 2e602d6641 [TEST] reset subAggregationsSupplier in AggregationsTests to empty sub-aggs once the maxDepth is reached
If we don't do this, although we don't set the subAggsSupplier again, we will reuse the one set in the previous run, hence we can end up in situations where we keep on generating sub aggregations till a StackOverflowError gets thrown.
2017-05-10 17:51:58 +02:00
Christoph Büscher 64ecf4f4bf Bumping version to v6.0.0-alpha2 2017-05-10 17:12:56 +02:00
David Roberts d611ab4855 Avoid race when shutting down controller processes (#24579)
This commit terminates any controller processes plugins might have after
the node has been closed.  This gives the plugins a chance to shut down their
controllers gracefully.

Previously there was a race condition where controller processes could be shut
down gracefully and terminated by two threads running in parallel, leading to
non-deterministic outcomes.

Additionally, controller processes that failed to shut down gracefully were
not forcibly terminated when running as a Windows service; there was a reliance
on the plugin to shut down its controller gracefully in this situation.
This commit also fixes this problem.
2017-05-10 14:59:14 +01:00
Tanguy Leroux 3201e22710 Fix merging conflicts 2017-05-10 14:05:43 +02:00
Tanguy Leroux bf718a686f Merge remote-tracking branch 'origin/master' into feature/client_aggs_parsing
# Conflicts:
#	core/src/test/java/org/elasticsearch/search/aggregations/bucket/terms/InternalTermsTestCase.java
#	core/src/test/java/org/elasticsearch/search/aggregations/metrics/InternalExtendedStatsTests.java
#	core/src/test/java/org/elasticsearch/search/aggregations/metrics/InternalMaxTests.java
#	core/src/test/java/org/elasticsearch/search/aggregations/metrics/InternalStatsTests.java
#	core/src/test/java/org/elasticsearch/search/aggregations/metrics/avg/InternalAvgTests.java
#	core/src/test/java/org/elasticsearch/search/aggregations/metrics/cardinality/InternalCardinalityTests.java
#	core/src/test/java/org/elasticsearch/search/aggregations/metrics/geobounds/InternalGeoBoundsTests.java
#	core/src/test/java/org/elasticsearch/search/aggregations/metrics/geocentroid/InternalGeoCentroidTests.java
#	core/src/test/java/org/elasticsearch/search/aggregations/metrics/min/InternalMinTests.java
#	core/src/test/java/org/elasticsearch/search/aggregations/metrics/percentiles/InternalPercentilesTestCase.java
#	core/src/test/java/org/elasticsearch/search/aggregations/metrics/percentiles/hdr/InternalHDRPercentilesRanksTests.java
#	core/src/test/java/org/elasticsearch/search/aggregations/metrics/percentiles/tdigest/InternalTDigestPercentilesRanksTests.java
#	core/src/test/java/org/elasticsearch/search/aggregations/metrics/sum/InternalSumTests.java
#	core/src/test/java/org/elasticsearch/search/aggregations/metrics/valuecount/InternalValueCountTests.java
#	core/src/test/java/org/elasticsearch/search/aggregations/pipeline/InternalSimpleValueTests.java
#	core/src/test/java/org/elasticsearch/search/aggregations/pipeline/bucketmetrics/percentile/InternalPercentilesBucketTests.java
#	core/src/test/java/org/elasticsearch/search/aggregations/pipeline/derivative/InternalDerivativeTests.java
#	test/framework/src/main/java/org/elasticsearch/test/InternalAggregationTestCase.java
2017-05-10 13:40:39 +02:00
Tanguy Leroux 3e4406f044 [Test] Fix wrong import 2017-05-10 12:31:28 +02:00
Tanguy Leroux 2fe53be0db [Test] Add unit tests for Range aggregations (#24569)
Related to #22278
2017-05-10 12:22:52 +02:00
Tanguy Leroux 7c97296d77 [Test] Reference Terms aggregations in AggregationsTests 2017-05-10 11:37:20 +02:00
Tanguy Leroux 2178491387 Fix checkstyle violation 2017-05-10 11:34:34 +02:00
Martijn van Groningen 51c74ce547
Added unit tests for InternalMatrixStats.
Also moved InternalAggregationTestCase to test-framework module in order to make use of it from other modules than core.

Relates to #22278
2017-05-10 11:06:18 +02:00
Matt Weber b24326271e Add ICUCollationFieldMapper (#24126)
Adds a new "icu_collation" field type that exposes lucene's
ICUCollationDocValuesField.  ICUCollationDocValuesField is the replacement
for ICUCollationKeyFilter which has been deprecated since Lucene 5.
2017-05-10 10:35:11 +02:00
Tanguy Leroux 3c66ac06ae Add parsing for String/Long/Double Terms aggregations (#24521) 2017-05-10 10:17:25 +02:00
Ryan Ernst 9ca7d28552 Scripting: Remove "service" from ScriptEngine interface name (#24574)
This commit renames ScriptEngineService to ScriptEngine.  It is often
confusing because we have the ScriptService, and then
ScriptEngineService implementations, but the latter are not services as
we see in other places in elasticsearch.
2017-05-10 00:47:33 -07:00
Christoph Büscher 01b976071f Merge branch 'master' into feature/client_aggs_parsing 2017-05-10 09:40:26 +02:00
Ryan Ernst 5242d3aeb0 Fix ids query builder test to use the same logic for matchnodocs as the
builder itself
2017-05-09 16:53:19 -07:00
Ryan Ernst ebd3e5f73f Scripting: Deprecate file script settings (#24555)
File scripts have 2 related settings: the path of file scripts, and
whether they can be dynamically reloaded. This commit deprecates those
settings.

relates #21798
2017-05-09 16:14:57 -07:00
Ryan Ernst 53f6d9412e Fix ids query test when none or ALL type is used
See #24460
2017-05-09 14:52:28 -07:00
Jason Tedor b6906702cc Remove global checkpoint constraint
A constraint on the global checkpoint was inadvertently committed from
the inlining global checkpoint work. Namely, the constraint prevents the
global checkpoint from advancing to no ops performed, a situation that
can occur when shards are started but empty.
2017-05-09 17:17:09 -04:00
javanna 37dc165e7f [TEST] add test to verify that no aggs have been forgotten in AggregationsTests 2017-05-09 21:23:00 +02:00
Jason Tedor 8f873620ee Inline global checkpoints
Today we rely on background syncs to relay the global checkpoint under
the mandate of the primary to its replicas. This means that the global
checkpoint on a replica can lag far behind the primary. The commit moves
to inlining global checkpoints with replication requests. When a
replication operation is performed, the primary will send the latest
global checkpoint inline with the replica requests. This keeps the
replicas closer in-sync with the primary.

However, consider a replication request that is not followed by another
replication request for an indefinite period of time. When the replicas
respond to the primary with their local checkpoint, the primary will
advance its global checkpoint. During this indefinite period of time,
the replicas will not be notified of the advanced global
checkpoint. This necessitates a need for another sync. To achieve this,
we perform a global checkpoint sync when a shard falls idle.

Relates #24513
2017-05-09 15:08:11 -04:00
Luca Cavanna c5bdbecc64 [TEST] Add test for Aggregations#fromXContent (#24524)
AggregationsTests#testFromXContent verifies that parsing of aggregations works by combining multiple aggs at the same level, and also adding sub-aggregations to multi bucket and single bucket aggs, up to a maximum depth of 5.
2017-05-09 21:08:10 +02:00
Nik Everett bb06d8ec4f Allow plugins to build pre-configured token filters (#24223)
This changes the way we register pre-configured token filters so that
plugins can declare them and starts to move all of the pre-configured
token filters out of core. It doesn't finish the job because doing
so would make the change unreviewably large. So this PR includes
a shim that keeps the "old" way of registering pre-configured token
filters around.

The Lowercase token filter is special because there is a "special"
interaction between it and the lowercase tokenizer. I'm not sure
exactly what to do about it so for now I'm leaving it alone with
the intent of figuring out what to do with it in a followup.

This also renames these pre-configured token filters from
"pre-built" to "pre-configured" because that seemed like a more
descriptive name.

This is a part of #23658
2017-05-09 14:50:49 -04:00
Christoph Büscher 1959fd6a1a Merge branch 'master' into feature/client_aggs_parsing 2017-05-09 19:54:36 +02:00
Nik Everett 428390865c Tests: Give stats tests long to wait for listener
This test waited 10 seconds for a refresh listener to appear in
the stats. It turns out that in our NFS testing infrastructure this can
take a lot longer than 10 seconds. The error reported here:
https://elasticsearch-ci.elastic.co/job/elastic+elasticsearch+master+nfs/257/consoleFull
has it taking something like 15 seconds. This bumps the timeout
to a solid minute.

Closes #24417
2017-05-09 13:33:33 -04:00
Jim Ferenczi b6c714ccc8 Fix BWC for query_and_fetch 2017-05-09 18:52:53 +02:00
Jim Ferenczi a404f0aca7 Cleanup BWC for single shard optimization
The BWC layer is needed only for pre 5.3 indices.
2017-05-09 16:54:44 +02:00
Adrien Grand a72eaa8e0f Identify documents by their `_id`. (#24460)
Now that indices have a single type by default, we can move to the next step
and identify documents using their `_id` rather than the `_uid`.

One notable change in this commit is that I made deletions implicitly create
types. This helps with the live version map in the case that documents are
deleted before the first type is introduced. Otherwise there would be no way
to differenciate `DELETE index/foo/1` followed by `PUT index/foo/1` from
`DELETE index/bar/1` followed by `PUT index/foo/1`, even though those are
different if versioning is involved.
2017-05-09 16:33:52 +02:00
Jim Ferenczi 4df636b5ef Fix single shard scroll within a cluster with nodes in version >= 5.3 and <= 5.3 (#24512)
If a node in version >= 5.3 acts as a coordinating node during a scroll request that targets a single shard, the scroll may return the same documents over and over iff the targeted shard is hosted by a node with a version <= 5.3.
The nodes in this version will advance the scroll only if the search_type has been set to `query_and_fetch` though this search type has been removed in 5.3.
This change handles this situation by adding the removed search_type in the request that targets a node in version <= 5.3.
2017-05-09 09:14:17 +02:00
Tal Levy 423b0f5e3d add option for _ingest.timestamp to use new ZonedDateTime (#24030)
Previously, Mustache would call `toString` on the `_ingest.timestamp`
field and return a date format that did not match Elasticsearch's
defaults for date-mapping parsing. The new ZonedDateTime class in Java 8
happens to do format itself in the same way ES is expecting.

This commit adds support for a feature flag that enables the usage of this new date format 
that has more native behavior.

Fixes #23168.

This new fix can be found in the form of a cluster setting called
`ingest.new_date_format`. By default, in 5.x, the existing behavior
will remain the same. One will set this property to `true` in order to
take advantage of this update for ingest-pipeline convenience.
2017-05-08 15:06:39 -07:00
joachimdraeger fec1802e2f Fixes inefficient loading of snapshot repository data (#24510)
This commit fixes inefficient (worst case exponential) loading of 
snapshot repository data when checking for incompatible snapshots,
that was introduced in #22267.  When getting snapshot information,
getRepositoryData() was called on every snapshot, so if there are
a large number of snapshots in the repository and _all snapshots
were requested, the performance degraded exponentially.  This
commit fixes the issue by only calling getRepositoryData once and
using the data from it in all subsequent calls to get snapshot 
information.

Closes #24509
2017-05-08 17:43:01 -04:00
Ryan Ernst bd3717a0f8 Scripting: Deprecate file scripts (#24552)
File scripts will be removed in 6.0. This commit adds a deprecation
warning for 5.5 when the first file script is loaded.
2017-05-08 14:06:45 -07:00
Jason Tedor 0944577ee8 Remove commented code from ESILRTC
This commit removes some commented out code from
ESIndexLevelReplicationTestCase.java that was inadvertently committed.
2017-05-08 16:20:58 -04:00
Jason Tedor 1de5bb8cd5 Ensure test replicas have valid recovery state
When starting a new replication group in an index level replication test
case, a started replica would not have a valid recovery state. This
violates simple assumptions as replicas always have to have recovered
before being started. This commit causes this to be the case that this
assumption is not violated too.
2017-05-08 16:19:47 -04:00
Jason Tedor 89b305c09e Add global checkpoint assertion in index shard
We previously removed this assertion because it could be violated in
races. This commit adds this assertion back with sampling done more
carefully to avoid failures solely due to race conditions.
2017-05-08 13:37:28 -04:00
Jason Tedor bf32b0c59d Improve bootstrap checks error messages
When multiple bootstrap checks fail, it's not clear where one error
message begins and the next error message ends. This commit numbers the
bootstrap check error messages so they are easier to read.

Relates #24548
2017-05-08 12:32:57 -04:00
Lee Hinman 1907c46689 Refactor UpdateHelper into unit-testable pieces
This starts breaking up the `UpdateHelper.prepare` method so that each piece can
be individually unit tested. No actual functionality has changed.

Note however, that I did add a TODO about `ctx.op` leniency, which I'd love to
remove as a separate PR if desired.
2017-05-08 09:00:47 -06:00
Jason Tedor 0ec30eb8e0 Fix cache expire after access
This commit fixes a bug in the cache expire after access
implementation. The bug is this: if you construct a cache with an expire
after access of T, put a key, and then touch the key at some time t > T,
the act of getting the key would update the access time for the entry
before checking if the entry was expired. There are situations in which
expire after access would be honored (e.g., if the cache needs to prune
the LRU list to keep the cache under a certain weight, or a manual
refresh was called) but this behavior is otherwise broken.

Relates #24546
2017-05-08 09:49:14 -04:00
Hendrik Muhs f41ddb3607 Move MockLogAppender to elasticsearch test (#24542)
In order to make MockLogAppender (utility to test logging) available outside
of es-core move MockLogAppender from test core-tests to test framework. As
package names do not change, no need to change clients.
2017-05-08 13:02:27 +02:00
Jason Tedor bbdaf113d4 Remove gap skipping when opening engine
Today when opening the engine we skip gaps in the history, advancing the
local checkpoint until it is equal to the maximum sequence number
contained in the commit. This allows history to advance, but it leaves
gaps. A previous change filled these gaps when recovering from store,
but since we were skipping the gaps while opening the engine, this
change had no effect. This commit removes the gap skipping when opening
the engine allowing the gap filling to do its job.

Relates #24535
2017-05-08 06:38:28 -04:00
Koen De Groote 13c17c75b5 Remove unneeded empty string concatentation
This commit removes concatenation by empty string in places where it
is simply not needed to obtain a string representation.

Relates #24411
2017-05-06 00:28:53 -04:00