Commit Graph

2470 Commits

Author SHA1 Message Date
Simon Willnauer 487af301ea Remove guice from the index level
This commit removes guice from the index level and adds a simple extension point
to add class instances with an index-lifecycle scope.
2015-11-05 11:18:11 +01:00
Simon Willnauer 45f7844948 Make CodecService a simple per shard registry. 2015-11-05 11:18:10 +01:00
Martijn van Groningen fc02b2bb0f test: don't run the second cluster with http enabled. 2015-11-05 14:08:54 +07:00
Robert Muir 1a0a910d1e Merge pull request #14526 from rjernst/standalone_test
Add qa/evil-tests
2015-11-04 13:49:55 -05:00
Boaz Leskes efde8e8a26 Gateway: failure to update the cluster state with the recovered state should make sure it will be recovered later
We currently fail to follow the right failure paths.

See http://build-us-00.elastic.co/job/es_core_master_window-2008/2477/

Closes #14485
2015-11-04 09:42:24 +00:00
Boaz Leskes 8eff4e211a Improve some logging around master election and cluster state
Tweaks done while debugging http://build-us-00.elastic.co/job/es_core_master_window-2008/2477/

Closes #14481
2015-11-04 09:39:56 +00:00
Yannick Welsch 825d0c64e6 Add duration field to /_cat/snapshots
Closes #14385
2015-11-04 10:34:00 +01:00
Daniel Mitterdorfer ae9fcd4f2b Merge remote-tracking branch 'danielmitterdorfer/feature/12596' 2015-11-04 09:31:12 +01:00
Daniel Mitterdorfer fea88bbc02 Add System#exit(), Runtime#exit() and Runtime#halt() to forbidden APIs
Closes #12596
2015-11-04 09:29:55 +01:00
Daniel Mitterdorfer 9ea25164b2 Merge remote-tracking branch 'danielmitterdorfer/fix/13132' 2015-11-04 09:06:35 +01:00
Daniel Mitterdorfer 7b62267008 Geo: Allow numeric parameters enclosed in quotes for 'geohash_grid' aggregation
Originally, only numeric values were allowed for parameters of the
'geohash_grid' aggregation in contrast to other places in the REST
API.

With this commit we also allow that parameters are enclosed in quotes (i.e.
as JSON strings). Additionally, with this commit the valid range for
'precision' is enforced for the Java API and the REST API (the latter was
previously missing the check).

Closes #13132
2015-11-04 09:04:22 +01:00
Robert Muir 3d8b4dae33 remove the ability for code to change file permissions, this was
only needed for pluginmanager's test, and pluginmanager doesn't
even run with securitymanager yet.
2015-11-04 00:31:15 -05:00
Robert Muir 6be9954d28 remove jimfs dep in tests 2015-11-03 23:29:14 -05:00
Robert Muir 602feac915 move tests never running in jenkins to new evil tests module 2015-11-03 21:42:22 -05:00
Jason Tedor 9d42b8b22b Merge pull request #14497 from jasontedor/java-9-type-inference-concatenated-iterator
Fix Java 9 type inference issue
2015-11-03 16:56:49 -05:00
Robert Muir 79467a138a Add property permissions so groovy scripts can serialize json
Allowing read to these properties is not really dangerous, even if
the code surrounding them is.

Closes #14488
2015-11-03 15:21:55 -05:00
Jason Tedor 2398f41db2 Fix Java 9 type inference issue
This commit fixes a compilation issue due to modified type inference in
the latest JDK 9 early access builds. We just have to lend a helping
hand to type inference by being explicit about the type.

Closes #14496
2015-11-03 15:15:40 -05:00
xuzha fb1d8bb149 Add os.allocated_processors
Current processors setting is not reflected in nodes info API
("os.available_processors"). Add os.allocated_processors to shows
actual number of processors that we are using.
2015-11-03 09:50:17 -08:00
Jason Tedor b2c098630e Merge pull request #14483 from jasontedor/cluster-block-to-string-dangling-comma
Fix dangling comma in ClusterBlock#toString
2015-11-03 11:55:01 -05:00
Jason Tedor 832267bcc1 Fix dangling comma in ClusterBlock#toString
This commit address some serious health issues that could arise from a
dangerous combination of OCD, string concatentation, and dangling
commas,
2015-11-03 11:52:40 -05:00
Simon Willnauer 759948f6c1 Merge branch 'master' into refactor_query_shard_context 2015-11-03 17:10:13 +01:00
Simon Willnauer 968561ad49 apply review comments 2015-11-03 17:09:32 +01:00
Robert Muir b6a2318563 upgrade rhino for plugins/lang-javascript
the current jar is over 3 years old, we should upgrade it for bugfixes.
the current integration could be more secure: set a global policy and enforce additional (compile-time) checks

closes #14466
2015-11-03 09:53:07 -05:00
David Tvaltchrelidze ea4e514385 Fix HTML response during redirection
It misses a quote...

Closes #11374
2015-11-03 13:59:57 +00:00
javanna ce6aa258a9 Remove support for query_binary and filter_binary
query_binary and filter_binary are unused at this point, as we only parse on the coordinating node and the java api only holds structured java objects for queries and filters, meaning they all implement Writeable and get natively serialized.

Relates to #14308
Closes #14433
2015-11-03 14:05:45 +01:00
Jason Tedor 43323c3541 Fix bug in cat thread pool
This commit fixes a bug in cat thread pool. This bug resulted from a
refactoring of the handling of thread pool types. To get the previously
displayed thread pool type from the ThreadPoolType object,
ThreadPoolType#getType needs to be called.
2015-11-03 07:40:49 -05:00
Simon Willnauer d76ae6718e Merge pull request #14432 from s1monw/add_shard_failure_as_suppressed
Deduplicate cause if already contained in shard failures
2015-11-03 12:06:23 +01:00
Christoph Büscher 2fe519c3e7 Revert fd3a46a because fix is to fragile
Reverting fix for #13884 because it was discussed to be too
fragile with respect to future changes in lucene simple query
string parsing. Undoes fix and removes test.
2015-11-03 11:48:14 +01:00
Adrien Grand a7bf06ee3a Fix test bug in UpdateThreadPoolSettingsTests. 2015-11-03 11:35:47 +01:00
Simon Willnauer 3f94a566ff Deduplicate cause if already contained in shard failures
If we have a shard failure on SearchPhaseExecutionException
we can deduplicate the original cause and use the more informative
ShardSearchFailure containing the shard ID etc. but we should deduplicate
the actual cause to prevent stack trace duplication.
2015-11-03 11:35:28 +01:00
Jason Tedor 48ee09fbd4 Add missing license file to ThreadPoolTypeSettingsValidatorTests.java 2015-11-02 22:14:28 -05:00
Jason Tedor e3b8dc7121 Forbid changing thread pool types
This commit forbids the changing of thread pool types for any thread
pool. The motivation here is that these are expert settings with
little practical advantage.

Closes #14294, relates #2509, relates #2858, relates #5152
2015-11-02 20:52:48 -05:00
Simon Willnauer 4176964358 Cleanup query parsing and remove IndexQueryParserService
IndexQueryParserService is only a factory for QueryShardContext instances
which are not even bound to a shard. The service only forwards dependencies and even
references node level service directly which makes dependency seperation on shard,
index and node level hard. This commit removes the service entirely, folds the creation
of QueryShardContext into IndexShard which is it's logical place and detaches the
ClusterService needed for index name matching during query parsing with a simple predicate
interface on IndexSettings.
2015-11-02 21:20:11 +01:00
Robert Muir f83800b1d2 don't discard original exception (suspiciously/possibly eclipse-generated) 2015-11-02 12:05:44 -05:00
Christoph Büscher 45dbcc4402 Merge pull request #14255 from cbuescher/feature/add-query-level-test
Parsers should throw exception on unknown objects
2015-11-02 11:48:17 +01:00
Christoph Büscher 72463768f5 Query DSL: Parsers should throw exception on unknown object
This PR adds a randomized test to the query test base class
that mutates an otherwise correct query by adding an additional
object into the query hierarchy. Doing so makes the query illegal
and should trigger some kind of exception. The new test revelead
that some query parsers quietly return queries when called with
such an illegal query. Those are also fixed here.

Relates to #10974
2015-11-02 11:39:22 +01:00
javanna b56bbf62dd Validate query api: move query parsing on the coordinating node
Similarly to what we did with the search api, we can now also move query parsing on the coordinating node for the validate query api. Given that the explain api is a single shard operation (compared to search which is instead a broadcast operation), this doesn't change a lot in how the api works internally. The main benefit is that we can simplify the java api by requiring a structured query object to be provided rather than a bytes array that will get parsed on the data node. Previously if you specified a QueryBuilder it would be serialized in json format and would get reparsed on the data node, while now it doesn't go through parsing anymore (as expected), given that after the query-refactoring we are able to properly stream queries natively. Note that the WrapperQueryBuilder can be used from the java api to provide a query as a string, in that case the actual parsing of the inner query will happen on the data node.

Relates to #10217
Closes #14384
2015-11-02 11:21:20 +01:00
Ryan Ernst b6dee6bd43 Merge pull request #14375 from rjernst/sweep_up_maven
Remove maven pom files and supporting ant files
2015-10-30 18:59:11 -07:00
Ryan Ernst 0a4fa7453b Merge pull request #14402 from rjernst/reorganize_rr_gradle_plugin
Move RR gradle plugin files to match external repo paths
2015-10-30 15:20:09 -07:00
Lee Hinman f726e11da6 Move logging for the amount of free disk to TRACE
Since this can potentially be logged for every `canRemain`, it's nicer
to put it in TRACE rather than DEBUG.

Resolves #12843
2015-10-30 14:56:11 -06:00
Ryan Ernst 197ed57ea4 Build: Move RR gradle plugin files to match external repo paths
The RR gradle plugin is at
https://github.com/randomizedtesting/gradle-randomized-testing-plugin.
However, we currently have a copy of this, since the plugin is still in
heavy development. This change moves the files around so they can be
copied directly from the elasticsearch fork to that repo, for ease of
syncing.
2015-10-30 13:22:59 -07:00
Areek Zillur 13b60e1b92 update to lucene-5.4.x-snapshot-1711508 2015-10-30 15:42:02 -04:00
Nik Everett c521b27e31 Merge pull request #13657 from nik9000/remove_transport
Remove transform
2015-10-30 12:34:08 -04:00
Nik Everett 28633fae21 [mapping] Remove transform
Removes the mapping transform feature which when used made debugging very
difficult. Users should transform their documents on the way into
Elasticsearch rather than having Elasticsearch do it.

Closes #12674
2015-10-30 11:46:54 -04:00
Christoph Büscher 5fcc648047 Tests: Check exception from query parsers for unknown field
Most query parsers throw a ParsingException when they trying
to parse a field with an unknown name. This adds a generic
check for this to the AbstractQueryTestCase so the behaviour
gets tested for all query parsers. The test works by first
making sure the test query has a `boost` field and then
changing this to an unknown field name and checking for an
error.

There are exceptions to this for WrapperQueryBuilder
and QueryFilterBuilder, because here the parser only expects
the wrapped `query` element. MatchNoneQueryBuilder and
MatchAllQueryBuilder so far had setters for boost() and
queryName() but didn't render them, which is added here for
consistency.

GeoDistance, GeoDistanceRange and GeoHashCellQuery so far
treat unknown field names in the json as the target field name
of the center point of the query, which so far was handled by
overwriting points previously specified in the query. This
is changed here so that an attempt to use two different field names
to specify the central point of the query throws a
ParsingException

Relates to #10974
2015-10-30 16:36:00 +01:00
Simon Willnauer b17d8c2c97 Merge pull request #14355 from s1monw/rewrite_analysis_registry
Simplify Analysis registration and configuration
2015-10-30 12:01:31 +01:00
Simon Willnauer aa38d053d7 Simplify Analysis registration and configuration
This change moves all the analysis component registration to the node level
and removes the significant API overhead to register tokenfilter, tokenizer,
charfilter and analyzer. All registration is done without guice interaction such
that real factories via functional interfaces are passed instead of class objects
that are instantiated at runtime.

This change also hides the internal analyzer caching that was done previously in the
IndicesAnalysisService entirely and decouples all analysis registration and creation
from dependency injection.
2015-10-30 11:40:18 +01:00
Yannick Welsch 017af34971 Merge pull request #14360 from ywelsch/fix/rest-indices-action
Properly set indices and indicesOptions on subrequest made by /_cat/indices
2015-10-30 11:34:04 +01:00
Ryan Ernst 542522531a Build: Remove maven pom files and supporting ant files
This change removes the leftover pom files. A couple files were left for
reference, namely in qa tests that have not yet been migrated (vagrant
and multinode). The deb and rpm assemblies also still exist for
reference when finishing their setup in gradle.

See #13930
2015-10-29 23:53:49 -07:00
Ryan Ernst 63f6c6db85 Build: Move test framework files to their new location
The test jar was previously built in maven by copying class files. With
gradle we now have a proper test framework artifact. This change moves
the classes used by the test framework into the test-framework module.

See #13930
2015-10-29 23:25:24 -07:00
Jason Tedor c7897a7524 Make throw statement consistent with others in same class 2015-10-29 21:53:33 -04:00
Lee Hinman 3b5058017e Merge branch 'remove-optimize-rest' 2015-10-29 15:18:03 -06:00
Ryan Ernst c86100f636 Switch build system to Gradle
See #13930
2015-10-29 11:40:19 -07:00
Yannick Welsch 15bd182668 Properly set indices and indicesOptions on subrequest made by /_cat/indices 2015-10-29 19:15:56 +01:00
Robert Muir 1194cd0bdc Add threadgroup isolation.
Closes #14353

Squashed commit of the following:

commit edae0729f71ea3d3f9fa9c0d27c9effc042eb5a9
Author: Robert Muir <rmuir@apache.org>
Date:   Thu Oct 29 14:13:42 2015 -0400

    update sha1 and simplify test

commit 635c4f245d66ad353a16267c810e02b725553fad
Author: Robert Muir <rmuir@apache.org>
Date:   Thu Oct 29 07:01:26 2015 -0400

    Add threadgroup isolation.

    Code with `modifyThread` and `modifyThreadGroup` may only modify
    its own threadgroup (or an ancestor of that). This enforces
    what is intended by the ThreadGroup class.

    This has two immediate implications:
    1. Code without these permissions (scripts) may not create or mess with threads
    2. ES application threads cannot mess with Java system threads

    ES puts all application threads in one single group today, but in the future
    this can be organized better, and we will have more isolation in the system.
2015-10-29 14:14:27 -04:00
Simon Willnauer 84fda97bb6 Merge pull request #14321 from s1monw/use_nano_time
Use System.nanoTime() to initialize Engine.lastWriteNanos
2015-10-29 16:48:36 +01:00
Boaz Leskes 5380322947 Recovery: mark shard as recovering on the cluster state thread
Closes #14115
Closes #14276
2015-10-29 11:41:23 +01:00
Clinton Gormley 085f9e032b Added versions 2.0.0 and 2.0.1-SNAPSHOT and bwc indices for 2.0.0 2015-10-28 21:21:06 +01:00
Robert Muir 0d0a4b3ff7 Upgrade to randomizedtesting 2.2.0
Closes #14342
2015-10-28 15:28:30 -04:00
Jason Tedor 06853209aa Fix issues with failed cache loads
This commit fixes two issues that could arise when a loader throws an
exception during a load in Cache#computeIfAbsent.

The underlying issue is that if the loader throws an exception,
Cache#computeIfAbsent would attempt to remove the polluted entry from
the cache. However, this cleanup was performed outside of the segment
lock. This means another thread could race and expire the polluted
entry (leading to NPEs) or get a polluted entry out of the cache before
the loading thread had a chance to cleanup (leading to ISEs).

The solution to the initial problem of correctly handling failed cached
loads is to check for failed loads in all places where entries are
retrieved from the map backing the segment. In such cases, we treat it
as if there was no entry in the cache, and we clean up the cache on a
best-effort basis. All of this is done outside of the segment lock to
avoid reintroducing the deadlock that was initially a problem when
loads were executed under a segment lock.
2015-10-28 14:22:46 -04:00
xuzha 97ecd7bf5a Expose pending cluster state queue size in node stats
Add 3 stats about the queue: total queue size, number of committed cluster
states, and number of pending cluster states.
2015-10-28 10:59:15 -07:00
Nicholas Knize 8c535e0f6e Refactor Geo utilities to Lucene 5.4
Remove local lucene/XGeo* classes and refactor to Lucene 5.4 Geo Utility classes.
2015-10-28 11:41:56 -05:00
Jason Tedor 1390e68465 Fix test bug in CacheTests#testDependentKeyDeadlock 2015-10-28 11:05:00 -04:00
Christoph Büscher 813f494f12 Tests: Fixed missing import 2015-10-28 15:57:11 +01:00
Christoph Büscher e7294322af Merge pull request #14286 from cbuescher/add-loop-querytests
Tests: run base query tests for more than one random query
2015-10-28 15:40:21 +01:00
Jason Tedor 90528ce5af Merge pull request #14334 from jasontedor/cache-deadlock-test
Add cache deadlock test
2015-10-28 10:30:25 -04:00
Jason Tedor baf361f1f9 Add cache deadlock test
This commit adds a unit test for a deadlock issue that existed prior to
commit 1d0b93f766. While commit
1d0b93f766 seems to have addressed the
deadlock issue it would be more robust to have a unit test for it and a
unit test will reduce the risk that future maintenance on Cache will
reintroduce the deadlock issue. This test reliably fails prior to but
passes after commit 1d0b93f766.
2015-10-28 10:29:53 -04:00
Adrien Grand 2ed02f9eb3 Merge pull request #14320 from jpountz/upgrade/lucene-5.4-snapshot-1710880
Upgrade to lucene-5.4-snapshot-1710880.
2015-10-28 14:45:45 +01:00
Christoph Büscher fdcfc7e817 Fix CI failure for recent commit in SimpleQueryStringBuilder 2015-10-28 13:58:36 +01:00
Robert Muir 1672bcc21c Merge pull request #14329 from rmuir/uncaught_exc
Remove uncaught exception handler in tests.
2015-10-28 08:05:44 -04:00
Christoph Büscher fd3a46a1a5 Query DSL: Fix `minimum should match` in `simple_query_string` for single term and multiple fields
Currently a `simple_query_string` query with one term and multiple fields
gets parsed to a BooleanQuery where the number of clauses is determined
by the number of fields, which lead to wrong calculation of `minimum_should_match`.

This PR adds checks to detect this case and wrap the resulting BooleanQuery into
another BooleanQuery with just one should-clause, so `minimum_should_match`
calculation is corrected.

In order to differentiate between the case where one term is queried across
multiple fields and the case where multiple terms are queried on one field,
we override a simplification step in Lucenes SimpleQueryParser that reduces
a one-clause BooleanQuery to the clause itself.

Closes #13884
2015-10-28 12:14:25 +01:00
Jason Tedor 172ad38408 Add listener mechanism for failures to send shard failed
This commit adds a listener mechanism for executing callbacks when
exceptional situations occur sending a shard failure message to the
master. The two types of exceptional situations that can occur are if
the master is not known and if the transport request exception handler
is invoked for any reason after sending the shard failed request to the
master. This commit only adds the infrastructure for executing
callbacks when one of these exceptional situations occur; no effort is
made to properly handle the exceptional situations. Some unit tests are
added for ShardStateAction to test that the listener infrastructure is
correct.

Relates #14252
2015-10-28 06:38:21 -04:00
Jason Tedor 68c6c6400d Fix typo in TransportReplicationActionTests#runReplicateTest 2015-10-28 06:31:41 -04:00
javanna 69cd23d2f4 Remove support for deprecated top level filter in search api
Replaced by post_filter since 1.0

Closes #8862
2015-10-28 10:50:29 +01:00
javanna d7cd5ce60d Remove support for deprecated minimum_should_match and disable_coord in terms query
Use bool query instead.
2015-10-28 10:50:29 +01:00
javanna 49f5757ae2 Remove support for multiple highlighter names
The only way to refer to the plain highlighter is now `plain`, the only way to refer to the fast vector highlighter is `fvh` and the only way to refer to the postings highlighter is `postings`. The name variants like `highlighter`, `postings-highlighter` and `fast-vector-highlighter` have been removed.
2015-10-28 10:50:29 +01:00
javanna 6076ccb7b2 Remove support for filter element in nested query
Replaced by query.
2015-10-28 10:50:29 +01:00
javanna 152f2697f7 Remove support for filter element in function_score query
Replaced by query element.
2015-10-28 10:50:28 +01:00
javanna e14c0451d4 Remove support for edit_distance in completion suggester
Replaced by fuzziness, consistent with other queries.
2015-10-28 10:50:28 +01:00
javanna 69881d5e92 Remove support for fuzzy_min_sim in query_string query
Replaced by fuzziness, consistent with other queries.
2015-10-28 10:50:28 +01:00
javanna 77511643ee Remove support for min_similarity in fuzzy query
Replaced by fuzziness, consistent with other queries.
2015-10-28 10:50:28 +01:00
javanna b66318c3ec Remove support for deprecated execution element in terms query 2015-10-28 10:50:28 +01:00
javanna a4b89d380c Remove filter and no_match_filter element support from indices query
Use query and no_match_query elements instead.
2015-10-28 10:50:28 +01:00
javanna ea750de39f Explain api: move query parsing to the coordinating node
Similarly to what we did with the search api, we can now also move query parsing on the coordinating node for the explain api. Given that the explain api is a single shard operation (compared to search which is instead a broadcast operation), this doesn't change a lot in how the api works internally. The main benefit is that we can simplify the java api by requiring a structured query object to be provided rather than a bytes array that will get parsed on the data node. Previously if you specified a QueryBuilder it would be serialized in json format and would get reparsed on the data node, while now it doesn't go through parsing anymore (as expected), given that after the query-refactoring we are able to properly stream queries natively.

Closes #14270
2015-10-28 10:42:03 +01:00
Simon Willnauer a56b108817 remove dead code 2015-10-28 10:36:08 +01:00
Adrien Grand 43958db10b Upgrade to lucene-5.4-snapshot-1710880. 2015-10-28 09:34:54 +01:00
Robert Muir 47540d5e82 Merge pull request #14327 from rmuir/symlinked_m2
support symlinked .m2/repository in tests
2015-10-28 00:18:09 -04:00
Robert Muir d0808c7148 Remove uncaught exception handler in tests.
This is not needed: full mvn verify passes.

Furthermore, there are all kinds of checks for this case
(rejected while shutting down) in the actual code, so there
is no need to have it here. If its supposed to be non-fatal,
then we add the missing places to the actual code, not globally to all threads.
2015-10-27 23:37:39 -04:00
Nicholas Knize 3d970f17f9 Fix Multi-geometry bbox
A long time coming this Upgrades to Spatial4J 0.5 which includes the fix for calculating a Multi-geometry bounding box.
2015-10-27 21:34:07 -05:00
Robert Muir 15e55e882f support symlinked .m2/repository in tests
Some jenkins servers have this, but our codebase normalization doesn't
follow symlinks. Add this so that its correct.

Only really impacts tests, i suppose it helps if someone has a symlinked plugins/
but that is not recommended :)
2015-10-27 21:24:48 -04:00
Robert Muir eec3c2a97c Cleanup plugin security
* plugin authors can use full policy syntax, including codebase substitution
  properties like core syntax.
* simplify test logic.
* move out test-framework permissions to separate file.

Closes #14311
2015-10-27 20:06:13 -04:00
Simon Willnauer c9076718b9 Use System.nanoTime() to initialize Engine.lastWriteNanos
On _lastWriteNanos_ we use System.nanoTime() to initialize this since:
 * we use the value for figuring out if the shard / engine is active so if we startup and no write has happened yet we still consider it active
   for the duration of the configured active to inactive period. If we initialize to 0 or Long.MAX_VALUE we either immediately or never mark it
   inactive if no writes at all happen to the shard.
 * we also use this to flush big-ass merges on an inactive engine / shard but if we we initialize 0 or Long.MAX_VALUE we either immediately or never
   commit merges even though we shouldn't from a user perspective (this can also have funky sideeffects in tests when we open indices with lots of segments
   and suddenly merges kick in.
2015-10-27 22:53:09 +01:00
Simon Willnauer ad1e3ab925 Merge pull request #14318 from s1monw/trash_get_all_stack_traces
Remove and forbid usage of Thread#getAllThreadGroups()
2015-10-27 21:56:11 +01:00
Adrien Grand 60a4e24e2f Merge pull request #14317 from jpountz/fix/cache_propagate_bulk_scorer
Caching Weight wrappers should propagate the BulkScorer.
2015-10-27 21:31:01 +01:00
Simon Willnauer 5fc1c8ba95 Remove and forbid usage of Thread#getAllThreadGroups()
This method needs special permission and can cause all kinds of other problems
if we are creating lots of theads. Also the reason why we added this are fixed
long ago, no need to maintain this code.
2015-10-27 21:13:48 +01:00
Adrien Grand 961df95599 Caching Weight wrappers should propagate the BulkScorer.
If we don't, then we will use the default bulk scorer, which can be
significantly slower in some cases (eg. disjunctions).

Related to https://issues.apache.org/jira/browse/LUCENE-6856
2015-10-27 19:14:14 +01:00
javanna 7eaac7b706 Deduplicate concrete indices after indices resolution
This commit fixes a regression introduced with #12058. This causes failures with the delete index api when providing the same index name multiple times in the request, or aliases/wildcard expressions that end up pointing to the same concrete index. The bug was revealed after merging #11258 as we delete indices in batch rather than one by one. The master node will expect too many acknowledgements based on the number of indices that it's trying to delete, hence the request will never be acknowledged by all nodes.

Closes #14316
2015-10-27 18:21:32 +01:00
Lee Hinman 3a458af0b7 Remove /_optimize REST API endpoint
The `/_optimize` endpoint was deprecated in 2.1.0 and can now be removed
entirely.
2015-10-27 10:17:16 -06:00
Simon Willnauer 935a8fc3d4 Merge pull request #14306 from s1monw/no_lenient_on_module
Don't be lenient in PluginService#processModule(Module)
2015-10-27 16:52:21 +01:00
Simon Willnauer 6fbfdb0e12 remove broken Stream registration API 2015-10-27 16:25:58 +01:00
javanna dc900a08a6 Remove "query" query and fix related parsing bugs
We have two types of parse methods for queries: one for the inner query, to be used once the parser is positioned within the query element, and one for the whole query source, including the query element that wraps the actual query.

With the search refactoring we ended up using the former in count, cat count and delete by query, whereas we should have used the former.  It ends up working properly given that we have a registered (deprecated) query called "query", which used to allow to wrap a filter into a query, but this has the following downsides:
1) prevents us from removing the deprecated "query" query
2) we end up supporting a top level query that is not wrapped within a query element (pre 1.0 syntax iirc that shouldn't be supported anymore)

This commit finally removes the "query" query and fixes the related parsing bugs. We also had some tests that were providing queries in the wrong format, those have been fixed too.

Closes #13326
Closes #14304
2015-10-27 14:54:30 +01:00
Simon Willnauer dde5e83ff4 Merge pull request #11258 from crate/b/reduce_cluster_state_updates_on_index_deletion
Bulk cluster state updates on index deletion
2015-10-27 14:49:40 +01:00
Simon Willnauer 67cdd21573 Don't be lenient in PluginService#processModule(Module)
We today catch the exception and move on - this is no good, we should just fail
all the way if something can't be loaded or processed
2015-10-27 14:48:19 +01:00
Philipp Bogensberger efa6c0b37f perform only one cluster state update per DeleteIndexRequest 2015-10-27 14:07:00 +01:00
Simon Willnauer 573c9948e3 fix test 2015-10-27 12:57:19 +01:00
Simon Willnauer f7fe2c2007 Open up QueryCache and SearcherWrapper extension points
This commit makes QueryCache and SearcherWrappoer registration public
otherwise plugins can't access those extension points due to security restrictions.
2015-10-27 12:52:52 +01:00
Simon Willnauer 04478a5a13 remove dead code 2015-10-27 11:21:30 +01:00
Simon Willnauer b7eb43cef6 make IndicesWarmer final in BitsetFilterCache 2015-10-27 11:21:30 +01:00
Simon Willnauer 6ac4be313a simplify the IndexWarmer interface even more 2015-10-27 11:21:30 +01:00
Simon Willnauer cc131eb328 fix tests 2015-10-27 11:21:30 +01:00
Simon Willnauer a5e5a5025b Fold IndexCacheModule into IndexModule
This commit brings all the registration etc. from IndexCacheModule into
IndexModule. As a side-effect to remove a circular dependency between
IndicesService and IndicesWarmer this commit also cleans up IndicesWarmer and
separates the Engine from the warmer.
2015-10-27 11:21:30 +01:00
Simon Willnauer cbcd7a9de7 apply review comments 2015-10-26 20:58:34 +01:00
Simon Willnauer fc5a60c24f fix constants 2015-10-26 20:56:01 +01:00
Simon Willnauer cc3532f593 Remove circular dependency between IndicesService and IndicesStore
This commit introduces a new IndexStoreConfig that is passed to
IndexStore instances instead it's pretty messy parent service.
2015-10-26 20:56:01 +01:00
Jason Tedor fcc2c19600 Merge pull request #14288 from jasontedor/plugin-list
Fix plugin list command error message
2015-10-26 14:08:08 -04:00
Jason Tedor 65fccb9478 Fix plugin list command error message
Closes #14287
2015-10-26 14:02:48 -04:00
Yannick Welsch 2f10300a03 Merge pull request #14247 from ywelsch/feature/cat-snapshots
Add cat API for repositories and snapshots
2015-10-26 18:40:39 +01:00
Adrien Grand f69c350960 Revert "Improve `min_score` implementation."
This reverts commit 56ea65b0f8.
2015-10-26 18:37:35 +01:00
Yannick Welsch ca75b7b6ce Add cat API for repositories and snapshots
Closes #14247
Closes #13919
2015-10-26 18:37:10 +01:00
Christoph Büscher 593df189e4 Tests: run base query tests for more than one random query 2015-10-26 17:39:14 +01:00
Simon Willnauer cb3122baab Merge pull request #14284 from s1monw/fold_similarity_module_into_index_module
Fold SimilarityModule into IndexModule
2015-10-26 14:47:09 +01:00
Simon Willnauer 586bfc720d Fold SimilarityModule into IndexModule
IndexModule is the central extension point we should centralize the extension mechanism
towards removing guice entirely on the index level.
2015-10-26 14:21:12 +01:00
Adrien Grand 1804e7d9e8 Merge pull request #14202 from jpountz/enhancement/min_score
Improve `min_score` implementation.
2015-10-26 14:10:36 +01:00
Simon Willnauer 21f3cb09c2 Merge pull request #14279 from s1monw/no_guice_on_store
Remove guice injection from IndexStore and friends
2015-10-26 14:08:31 +01:00
Simon Willnauer d6455a5a76 Use actual parameter passed to the ctor 2015-10-26 13:57:27 +01:00
Simon Willnauer 5ffdf15f02 Remove guice injection from IndexStore and friends
This commit replaces dependency injection from IndexStore and subclasses
and replaces it with dedicated set of dependencies.
2015-10-26 12:32:34 +01:00
Simon Willnauer 3b82b585f3 Use Long.MAX_VALUE to indicate that there has not yet been any modifications
Relates to #14275
2015-10-26 12:30:58 +01:00
Adrien Grand 56ea65b0f8 Improve `min_score` implementation.
This changes how `min_score` is implemented both for `function_score` and the
search request parameter to confirm whether the minimum score is met in the
`matches()` phase of a TwoPhaseIterator.
2015-10-26 12:01:50 +01:00
Simon Willnauer c41dd965fb s/ / / 2015-10-26 11:08:10 +01:00
Simon Willnauer edef67ffdc Merge branch 'master' into renew_syn_on_merge 2015-10-26 11:05:57 +01:00
Yannick Welsch c335b3a176 Fix AckClusterUpdateSettingsIT.testClusterUpdateSettingsAcknowledgement() after changes in #14259
Closes #14278
2015-10-26 11:02:30 +01:00
Simon Willnauer 969b385c59 assign IMC frst 2015-10-26 10:59:27 +01:00
Simon Willnauer d07863c4a3 fix javadoc and pass a better reason to refresh 2015-10-26 10:44:00 +01:00
Simon Willnauer 8be506224d Push last modified timestamp to engine and use a time delta to flush merges 2015-10-26 10:37:11 +01:00
Yannick Welsch b1cfa7b1d2 Check rebalancing constraints when shards are moved from a node they can no longer remain on
Closes #14259
Closes #14057
2015-10-26 09:26:20 +01:00
Simon Willnauer 885af39fe2 Flush big merges automatically if shard is inactive
Today if a shard is marked as inactive after a heavy indexing period
large merges are very likely. Yet, those merges are never committed today
since time-based flush has been removed and unless the shard becomes active
again we won't revisit it.
Yet, inactive shards have very likely been sync-flushed before such that we need
to maintain the sync id if possible which this change tries on a per shard basis.
2015-10-24 22:45:17 +02:00
Boaz Leskes 6855e360a0 Test: MinimumMasterNodesIT.testCanNotPublishWithoutMinMastNodes should wait for state to be recovered
The test spawns up 3 nodes, waits for a master to be elected and starts network disruptions. If those kick in too early we may have a cluster with a state not recovered block which causes failure during clean ups.  http://build-us-00.elastic.co/job/es_core_master_oracle_6/3034/
2015-10-24 17:18:51 +02:00
Simon Willnauer beac4b17be Merge pull request #14251 from s1monw/trash_index_settings
Replace IndexSettings annotation with a full-fledged class
2015-10-24 15:38:46 +02:00
Simon Willnauer df9432fcee apply review comments 2015-10-24 15:24:52 +02:00
Simon Willnauer e2be57f395 [TEST] properly disable merges 2015-10-24 15:17:53 +02:00
Robert Muir 6c8e290322 Allow binding to multiple addresses
* Allow for multiple host specifications (e.g. _en0_,192.168.1.2,_site_).
* Add _site_ and _global_ scopes as counterparts to _local_.
* Warn on heuristic selection of publish address.
* Remove the arbitrary _non_loopback_ setting.

Closes #13954
2015-10-23 23:43:37 -04:00
Robert Muir c7f5911d1b Merge pull request #14135 from rmuir/jail_filestore_exception
Give a better exception when running from freebsd jail without enforce_statfs=1
2015-10-23 23:23:56 -04:00
Robert Muir c3381b24fe Add workaround for JDK-8014008
We should not implement this method, it is a real problem. But I think
it is ok to workaround the JDK bug (https://bugs.openjdk.java.net/browse/JDK-8014008).

This allows jconsole/visualvm to work in the meantime.
2015-10-23 21:57:50 -04:00
Simon Willnauer 42af6c6db9 fix test to not use client nodes 2015-10-23 12:21:56 +02:00
Simon Willnauer 82050e8d30 add integration test for adding and listening to a dynamic index setting 2015-10-23 12:04:54 +02:00
Simon Willnauer c1b1f395a7 pass the right settings to the listener 2015-10-23 11:05:37 +02:00
Simon Willnauer 8a9dd871d3 Make IndexSettings also own the IndexMetaData and separate node settings 2015-10-23 10:53:39 +02:00
Simon Willnauer 075e382c6d [TEST] wait for flush to ensure at least one segment is visible / existing 2015-10-23 09:17:57 +02:00
Simon Willnauer f8248eda61 apply review comments 2015-10-22 23:06:59 +02:00
Simon Willnauer 2245f480c9 add unittests & javadocs 2015-10-22 22:26:24 +02:00
Simon Willnauer 66d5d0c4f2 Replace IndexSettings annotation with a full-fledged class
The @IndexSettings annoationat has been used to differentiate between node-level
and index level settings. It was also decoupled from realtime-updates such that
the settings object that a class got injected when it was created was static and
not subject to change when an update was applied. This change removes the annoation
and replaces it with a full-fledged class that adds type-safety and encapsulates additional
functionality as well as checks on the settings.
2015-10-22 20:43:41 +02:00
Simon Willnauer 14aaeea25a Merge pull request #14169 from s1monw/issues/14168
Add option to disable closing indices
2015-10-22 20:09:59 +02:00
Simon Willnauer 76c660ba93 improve exception message 2015-10-22 20:09:31 +02:00
Simon Willnauer 06b1484d96 [TEST] Wait if flush is ongoing otherwise test sometimes fails due to FlushNotAllowedEngineException 2015-10-22 16:49:37 +02:00
Simon Willnauer bc3b91eb57 [TEST] Don't delete index from the clusterstate otherwise it might be concurrently removed 2015-10-22 09:43:02 +02:00
Simon Willnauer 04dec8470a [TEST] Add test for #14232
Test that ClassSet bindings bound as eager singletons
2015-10-21 22:59:26 +02:00
Simon Willnauer 8f490f527a Merge pull request #14232 from jaymode/class_set_binding
properly bind ClassSet extensions as singletons
2015-10-21 22:58:25 +02:00
Simon Willnauer 4fea56cead Replace IndicesLifecycle with a per-index IndexEventListener
Today IndicesLifecycle is a per-node class that allows to register
listeners at any time. It also requires to de-register if listeners
are not needed anymore ie. if classes are created per-index / shard etc.
They also cause issues where listeners are registered more than once as in #13259

This commit removes the per-node class and replaces it with an well defined
extension point that allows listeners to be registered at index creation time
without the need to unregister since listeners are go out of scope if the index
goes out of scope. Yet, this still allows to share instances across indices as before
but without the risk of double registering them etc.

All data-structures used for event notifications are now immuatble and can only changes
on index creation time. This removes flexibility to some degree but increases maintainability
of the interface and the code itself dramatically especially with the step by step removal of
the index level dependency injection.

Closes #13259
2015-10-21 22:10:46 +02:00
jaymode ec4307f080 properly bind ClassSet extensions as singletons
The ExtensionPoint.ClassSet binds adds the extension classes to a a Multibinder and binds
the classes and calls the asEagerSingleton method on the multibinder. This does not actually
create a singleton. Instead we first bind the class as a singleton and add then add the class
to the multibinder.

Closes #14194
2015-10-21 15:01:24 -04:00
javanna 75cedca0da Remove search exists api
Closes #13682
Closes #13911
2015-10-21 17:39:32 +02:00
Adrien Grand fd592c6d76 Remove Lucene.isEmpty(DocIdSet).
After the Filter ban, this method is not used anymore.
2015-10-21 15:34:32 +02:00
Simon Willnauer 3ba4dfa3a6 Merge pull request #14206 from s1monw/refactor_shard_failure_listener
Refactor ShardFailure listener infrastructure
2015-10-21 13:40:56 +02:00
Adrien Grand f4e9f69f68 Merge pull request #14082 from jpountz/remove/uninverted_numeric_fielddata
Remove "uninverted" and "binary" fielddata support for numeric and boolean fields.
2015-10-21 13:03:15 +02:00
Adrien Grand 76231c89da Remove "uninverted" and "binary" fielddata support for numeric and boolean fields.
Numeric and boolean fields have doc values enabled by default as of
elasticsearch 2.0. This commit removes support for uninverted/in-memory
fielddata, as well as numeric fields encoded in binary doc values which was
the way that elasticsearch stored doc values in a Lucene index before the
1.4 release.

As a consequence, you will only be able to sort and aggregate on numeric and
boolean fields in Elasticsearch 3.0 if doc values have not been switched off.
2015-10-21 12:15:40 +02:00
javanna eaffa975e5 Restore support for escaped '/' as part of document id
With #13691 we introduced some custom logic to make sure that date math expressions like <logstash-{now/D}> don't get broken up into two where the slash appears in the expression. That said the only correct way to provide such a date math expression as part of the uri would be to properly escape the '/' instead. This fix also introduced a regression, as it would make sure that unescaped '/' are handled only in the case of date math expressions, but it removed support for properly escaped slashes anywhere else. The solution is to keep supporting escaped slashes only and require client libraries to properly escape them.

This commit reverts 93ad696 and makes sure that our REST tests runner supports escaping of path parts, which was more involving than expected as each single part of the path needs to be properly escaped. I am not too happy with the current solution but it's the best I could do for now, maybe not that concerning anyway given that it's just test code. I do find uri encoding quite frustrating in java.

Relates to #13691
Relates to #13665

Closes #14177
Closes #14216
2015-10-21 10:49:02 +02:00
Simon Willnauer cba210c439 apply review comments 2015-10-21 09:34:25 +02:00
Lee Hinman b3646f9bfc Merge remote-tracking branch 'dakrone/use-the-force-luke' 2015-10-20 21:13:18 -06:00
Nik Everett 2cc97a0d3e Remove and ban @Test
There are three ways `@Test` was used. Way one:

```java
@Test
public void flubTheBlort() {
```

This way was always replaced with:

```java
public void testFlubTheBlort() {
```

Or, maybe with a better method name if I was feeling generous.

Way two:

```java
@Test(throws=IllegalArgumentException.class)
public void testFoo() {
    methodThatThrows();
}
```

This way of using `@Test` is actually pretty OK, but to get the tools to ban
`@Test` entirely it can't be used. Instead:

```java
public void testFoo() {
    try {
        methodThatThrows();
        fail("Expected IllegalArgumentException");
    } catch (IllegalArgumentException e ) {
        assertThat(e.getMessage(), containsString("something"));
    }
}
```

This is longer but tests more than the old ways and is much more precise.
Compare:

```java
@Test(throws=IllegalArgumentException.class)
public void testFoo() {
    some();
    copy();
    and();
    pasted();
    methodThatThrows();
    code();  // <---- This was left here by mistake and is never called
}
```

to:

```java
@Test(throws=IllegalArgumentException.class)
public void testFoo() {
    some();
    copy();
    and();
    pasted();
    try {
        methodThatThrows();
        fail("Expected IllegalArgumentException");
    } catch (IllegalArgumentException e ) {
        assertThat(e.getMessage(), containsString("something"));
    }
}
```

The final use of test is:

```java
@Test(timeout=1000)
public void testFoo() {
    methodThatWasSlow();
}
```

This is the most insidious use of `@Test` because its tempting but tragically
flawed. Its flaws are:
1. Hard and fast timeouts can look like they are asserting that something is
faster and even do an ok job of it when you compare the timings on the same
machine but as soon as you take them to another machine they start to be
invalid. On a slow VM both the new and old methods fail. On a super-fast
machine the slower and faster ways succeed.
2. Tests often contain slow `assert` calls so the performance of tests isn't
sure to predict the performance of non-test code.
3. These timeouts are rude to debuggers because the test just drops out from
under it after the timeout.

Confusingly, timeouts are useful in tests because it'd be rude for a broken
test to cause CI to abort the whole build after it hits a global timeout. But
those timeouts should be very very long "backstop" timeouts and aren't useful
assertions about speed.

For all its flaws `@Test(timeout=1000)` doesn't have a good replacement __in__
__tests__. Nightly benchmarks like http://benchmarks.elasticsearch.org/ are
useful here because they run on the same machine but they aren't quick to check
and it takes lots of time to figure out the regressions. Sometimes its useful
to compare dueling implementations but that requires keeping both
implementations around. All and all we don't have a satisfactory answer to the
question "what do you replace `@Test(timeout=1000)`" with. So we handle each
occurrence on a case by case basis.

For files with `@Test` this also:
1. Removes excess blank lines. They don't help anything.
2. Removes underscores from method names. Those would fail any code style
checks we ever care to run and don't add to readability. Since I did this manually
I didn't do it consistently.
3. Make sure all test method names start with `test`. Some used to end in `Test` or start
with `verify` or `check` and they were picked up using the annotation. Without the
annotation they always need to start with `test`.
4. Organizes imports using the rules we generate for Eclipse. For the most part
this just removes `*` imports which is a win all on its own. It was "required"
to quickly remove `@Test`.
5. Removes unneeded casts. This is just a setting I have enabled in Eclipse and
forgot to turn off before I did this work. It probably isn't hurting anything.
6. Removes trailing whitespace. Again, another Eclipse setting I forgot to turn
off that doesn't hurt anything. Hopefully.
7. Swaps some tests override superclass tests to make them empty with
`assumeTrue` so that the reasoning for the skips is logged in the test run and
it doesn't "look like" that thing is being tested when it isn't.
8. Adds an oxford comma to an error message.

The total test count doesn't change. I know. I counted.
```bash
git checkout master && mvn clean && mvn install | tee with_test
git no_test_annotation master && mvn clean && mvn install | tee not_test
grep 'Tests summary' with_test > with_test_summary
grep 'Tests summary' not_test > not_test_summary
diff with_test_summary not_test_summary
```

These differ somewhat because some tests are skipped based on the random seed.
The total shouldn't differ. But it does!
```
1c1
< [INFO] Tests summary: 564 suites (1 ignored), 3171 tests, 31 ignored (31 assumptions)
---
> [INFO] Tests summary: 564 suites (1 ignored), 3167 tests, 17 ignored (17 assumptions)
```

These are the core unit tests. So we dig further:
```bash
cat with_test | perl -pe 's/\n// if /^Suite/;s/.*\n// if /IGNOR/;s/.*\n// if /Assumption #/;s/.*\n// if /HEARTBEAT/;s/Completed .+?,//' | grep Suite > with_test_suites
cat not_test | perl -pe 's/\n// if /^Suite/;s/.*\n// if /IGNOR/;s/.*\n// if /Assumption #/;s/.*\n// if /HEARTBEAT/;s/Completed .+?,//' | grep Suite > not_test_suites
diff <(sort with_test_suites) <(sort not_test_suites)
```

The four tests with lower test numbers are all extend `AbstractQueryTestCase`
and all have a method that looks like this:

```java
@Override
public void testToQuery() throws IOException {
    assumeTrue("test runs only when at least a type is registered", getCurrentTypes().length > 0);
    super.testToQuery();
}
```

It looks like this method was being double counted on master and isn't anymore.

Closes #14028
2015-10-20 17:37:36 -04:00
Yannick Welsch 2ab81eee2d Remove unused method ActionFuture.getRootFailure()
Closes #14214
2015-10-20 22:22:22 +02:00
Christoph Büscher 5d25bc30cd Query DSL: Remove NotQueryBuilder
The NotQueryBuilder has been deprecated on the 2.x branches
and can be removed with the next major version. It can be
replaced by boolean query with added mustNot() clause.

Closes #13761
2015-10-20 19:43:16 +02:00
Jason Tedor 8361d7dbf4 Use built-in method for computing hash code of longs
This commit replaces instances of manually computing a hash code for
primitive longs by XORing the upper bits with the lower bits with a
built-in method for doing the same.
2015-10-20 11:46:58 -04:00
Lee Hinman 9ea4909035 Add Force Merge API, deprecate Optimize API
This adds an API for force merging lucene segments. The `/_optimize` API is now
deprecated and replaced by the `/_forcemerge` API, which has all the same flags
and action, just a different name.
2015-10-20 09:00:24 -06:00
Jason Tedor a0668a3b2b Merge pull request #14210 from jasontedor/remove-cache-concurrency-level-settings
Remove cache concurrency level settings that no longer apply
2015-10-20 10:31:32 -04:00
Adrien Grand 824b7b3845 Merge pull request #14209 from jpountz/fix/ban_filter_apis
Ban oal.search.Filter.
2015-10-20 16:22:28 +02:00
Jason Tedor 18b32f0ba5 Remove cache concurrency level settings that no longer apply
This commit removes some cache concurrency level settings that were
applicable when the cache was backed by the Guava cache implementation,
but no longer apply with the cache implementation completed in #13717.

Relates #7836, relates #13224, relates #13717
2015-10-20 10:15:03 -04:00
Adrien Grand 57310fc451 Ban oal.search.Filter.
Filter has been deprecated in Lucene 5.4 and will be removed in 6.0. We should
stop using this API.
2015-10-20 16:09:46 +02:00
Robert Muir 82eb5d299a check "plugin already installed" before jar hell check.
In the case of a plugin using the deprecated `isolated=false` functionality
this will cause confusion otherwise.

Closes #14205
Closes #14207
2015-10-20 09:59:04 -04:00
Simon Willnauer b772b513e0 Refactor ShardFailure listener infrastructure
Today we leak the notion of an engine outside of the shard abstraction
which is not desirable. This commit refactors the infrastrucutre to use
use already existing interfaces to communicate if a shard has failed and
prevents engine private classes to be implemented on a higher level.
This change is purely cosmentical...
2015-10-20 15:08:26 +02:00
Jason Tedor 1b461a7f9d Remove mistakenly committed build output files
This commit removes some build output files from the
burn_maven_with_fire_branch that appear to have been mistakenly
committed to master in bfb9054a11.
2015-10-20 08:34:51 -04:00
Robert Muir c037a67988 Drop ability to execute on Solaris
This is very simple to do and recommended by `privileges(5)` documentation:
```
Daemons that never need to exec subprocesses should remove the PRIV_PROC_EXEC privilege from their permitted and limit sets.
```

Closes #14200
2015-10-20 08:10:44 -04:00
Simon Willnauer fc38c147de Remove dead code 2015-10-20 13:59:53 +02:00
Isabel Drost-Fromm 4adf7c3d86 Fix the naming check. 2015-10-20 11:17:33 +02:00
Isabel Drost-Fromm 4338ffc8a7 Merge pull request #14189 from MaineC/doc-fix/13800
Updates java query dsl documentation
2015-10-20 10:56:43 +02:00
Isabel Drost-Fromm 5fbf49a0fb Minus 16 calls to getMessage
Adds *Exception(Throwable cause) constructors and calls them where appropriate
thus getting rid of 16 instances of calling getMessage and eliminating the risk
of loosing exception context.

Fixes ElasticsearchTimeoutException along the way (used to discard the
parameter args in the (String message, Object... args) constructor, passes it
up to super now.

Relates to #10021
2015-10-20 09:55:53 +02:00
Isabel Drost-Fromm dac88c0281 Updates java query dsl documentation
Closes #13800
2015-10-20 09:37:36 +02:00
Nicholas Knize 6d3dd727c2 Resync Geopoint hashCode/equals method
Geopoint's equals method was modified to consider two points equal if they are within a threshold. This change was done to accept round-off error introduced from GeoHash encoding methods. This commit removes this trappy leniency from the GeoPoint equals method and instead forces round-off error to be handled at the encoding source.
2015-10-19 14:52:31 -05:00
Jason Tedor 2668bdc42e Rename ShardReplicationTests to TransportReplicationActionTests
This commit renames ShardReplicationTests to
TransportReplicationActionTests. This rename is to reflect the fact
that the tests contained in this test suite are for testing
TransportReplicationAction. This class was previously renamed but the
test suite was not.
2015-10-19 11:14:14 -04:00
Nik Everett 1cb3068737 Make root_cause of field conflicts more obvious
Does so by improving the error message passed to MapperParsingException.

The error messages for mapping conflicts now look like:
```
{
  "error" : {
    "root_cause" : [ {
      "type" : "mapper_parsing_exception",
      "reason" : "Failed to parse mapping [type_one]: Mapper for [text] conflicts with existing mapping in other types:\n[mapper [text] has different [analyzer], mapper [text] is used by multiple types. Set update_all_types to true to update [search_analyzer] across all types., mapper [text] is used by multiple types. Set update_all_types to true to update [search_quote_analyzer] across all types.]"
    } ],
    "type" : "mapper_parsing_exception",
    "reason" : "Failed to parse mapping [type_one]: Mapper for [text] conflicts with existing mapping in other types:\n[mapper [text] has different [analyzer], mapper [text] is used by multiple types. Set update_all_types to true to update [search_analyzer] across all types., mapper [text] is used by multiple types. Set update_all_types to true to update [search_quote_analyzer] across all types.]",
    "caused_by" : {
      "type" : "illegal_argument_exception",
      "reason" : "Mapper for [text] conflicts with existing mapping in other types:\n[mapper [text] has different [analyzer], mapper [text] is used by multiple types. Set update_all_types to true to update [search_analyzer] across all types., mapper [text] is used by multiple types. Set update_all_types to true to update [search_quote_analyzer] across all types.]"
    }
  },
  "status" : 400
}
```

Closes #12839

Change implementation

Rather than make a new exception this improves the error message of the old
exception.
2015-10-19 10:42:55 -04:00
Nik Everett a963385dee Merge pull request #14134 from nik9000/bundle_shard_routing
Bundle TestShardRouting in test jar
2015-10-19 10:00:22 -04:00
javanna a6e7a5f307 Java api: remove the count api
Closes #14166
Closes #13928
2015-10-19 14:40:52 +02:00
Britta Weber 15a63f3ec7 Merge pull request #14089 from brwe/fix-test-access-denied
fix access denied for shard deletion with WindowsFS
2015-10-19 14:25:26 +02:00
Simon Willnauer c5cf5cde8f add several code comments and apply review comments 2015-10-19 13:32:49 +02:00
Simon Willnauer 9487a8e1fd apply review comments 2015-10-19 13:32:49 +02:00
Simon Willnauer b40c1deebe Remove MetaDataSerivce and it's semaphores
MetaDataSerivce tried to protect concurrent index creation/deletion
from resulting in inconsistent indices. This was originally added a
long time ago via #1296 which seems to be caused by several problems
that we fixed already in 2.0 or even in late 1.x version. Indices where
recreated without being deleted and shards where deleted while being used
which is now prevented on several levels. We can safely remove the semaphores
since we are already serializing the events on the cluster state threads.
This commit also fixes some expception handling bugs exposed by the added test
2015-10-19 13:32:49 +02:00
Simon Willnauer 06b1d956f8 Merge pull request #13801 from achow/achow/omit-old-current-stats
Omit current* stats for OldShardStats (closes #13386)
2015-10-19 11:48:02 +02:00
Luca Cavanna 6be72d220f Merge pull request #14007 from synhershko/patch-6
Fix ensureNodesAreAvailable's error message
2015-10-19 10:42:11 +02:00
Boaz Leskes fbe9c49e8f Internal: only have one CORS allow origin setting string
We currently have two, which is confusing when you  read the code (especially if one is used with a null default and the other with '*')

Note: this is not a real bug, just a  clean up. We do the right thing...

Closes #13988
2015-10-18 21:37:50 +02:00
Boaz Leskes de7d3cf752 Gateway: a race condition can prevent the initial cluster state from being recovered
After a full cluster restart, the elected master is tasked with recovery the last known cluster state from disk. To do so, the GatewayService registers it self as a listener to cluster state changes, triggering the recovery if the local node is elected. Sadly the initial post-election cluster state can be missed if it's being processed while the listener is registered (i.e., the listener is too late but the discoveryService.initialStateReceived is not yet set). In this case the cluster state from disk will be recovered with the next change (typically node join).

 In practice this is not a big deal as master election takes at least 3s (by which time the gateway is long started), but it does make some of our tests to fail: http://build-us-00.elastic.co/job/es_core_master_centos/7915/

 To fix this, we submit a cluster state task after the edition of the listener, so we are guaranteed to check things while they are at rest.

 While at it, I removed some left over latch which we don't really wait on anymore.

 Closes #13997
2015-10-18 21:15:07 +02:00
Simon Willnauer c71da4b999 Also catch EngineClosedException when pulling translog from potentially closed engine
When we check the engine if a flush is needed we don't catch EngineClosedException today
but the engine is potentially closed already in which case we can simply return false and don't need
to bubble up the exception.
2015-10-17 20:32:03 +02:00
Simon Willnauer db87594bca Add option to disable closing indices
Closed indices are currently out of scope for snapshots and shard migration,
and can cause issues in managed environments – where closing an index does
not necessarily make sense, as it still consumes the managed environment's storage quota.

This commit adds an option to dynamically disable closing indices via node or cluster settings.

Closes #14168
2015-10-16 22:10:51 +02:00
Jason Tedor 7f12806a7d Fix typo in o.e.c.r.a.d.ConcurrentRebalanceAllocationDecider 2015-10-16 10:06:33 -04:00
javanna a1c1a8b230 Query DSL: don't change state of the bool query while converting to lucene query
We used to change the minimumShouldMatch field of the query depending on the context, the final minimim should match should still be applied based on that, but the original minimumShouldMatch of the query shouldn't change. This was revelead by some recent test failure.

Closes #14153
2015-10-16 14:33:09 +02:00
Adrien Grand 5ae810991c Upgrade to lucene-5.4-snapshot-1708254. 2015-10-16 09:41:36 +02:00
Simon Willnauer cd0084915d Allow parser to move on the START_OBJECT token when parsing search source
Currently we require parser to be right before the sources START_OBJECT
but if we are parsing embedded search sources this won't work since we potentially
moved already on to the START_OBJECT. This commit make this optional such that
both ways work.
2015-10-15 22:28:05 +02:00
Nik Everett 68d708a75f Merge pull request #11398 from Collaborne/bugs/explain-function-script-quotes
Fix the quotes in the explain message for a script score function without parameters
2015-10-15 13:56:21 -04:00
Nik Everett 846c01f42a [test] Bundle TestShardRouting in test jar
Plugins want to use this too.

Closes #14133
2015-10-15 11:54:14 -04:00
Robert Muir b9e99cb240 Give a better exception when running from freebsd jail without enforce_statfs=1
We can't track disk usage in this situation, failing is the correct thing to do.
But we can give a FreeBSD-specific error message, so the user can set the
necessary jail parameters, versus a vague IOException.

Closes #12018
2015-10-15 09:44:53 -04:00
Colin Goodheart-Smithe cf3e92ae92 Merge branch 'master' into feature/search-request-refactoring 2015-10-15 13:51:00 +01:00
Colin Goodheart-Smithe ef5fc721e5 reverted non-null searchSourceBuilder in searchRequest for now 2015-10-15 13:49:43 +01:00
Robert Muir c3751801c6 Test that the lucene "unmap hack" is supported.
Closes #14120

Squashed commit of the following:

commit 556b7f5783211bd82a5d9796996e21be87b0404b
Author: Robert Muir <rmuir@apache.org>
Date:   Wed Oct 14 15:16:54 2015 -0400

    Add bugid link

commit b44aac7e9f1a97974938c17e013812ebf4c2fa76
Author: Robert Muir <rmuir@apache.org>
Date:   Wed Oct 14 15:01:41 2015 -0400

    Test that the lucene "unmap hack" is supported.

    We should know if this is not working for any configuration, otherwise resources such as address space, file handles, and even disk space become tied to Java's garbage collector.
2015-10-15 08:47:05 -04:00
Robert Muir 0dcac1448d Merge pull request #14126 from rmuir/seccomp_testbug
Fix SeccompTests bug on older kernels / add defense
2015-10-15 08:37:53 -04:00
javanna 0cab4a25fb Revert changes made to IndexQueryParserService, fixed upstream meanwhile 2015-10-15 14:35:16 +02:00
javanna 8a87448758 Revert changes made to IdsQueryBuilder, fixed upstream meanwhile 2015-10-15 14:28:39 +02:00
Colin Goodheart-Smithe 63c51b78b2 review comment fixes 2015-10-15 11:34:31 +01:00
Alexander Reelsen bbaf7ea0f0 Release 1.7.3: Added bwc indices and updated Version.java 2015-10-15 12:26:18 +02:00
Colin Goodheart-Smithe c618f75b76 Merge branch 'master' into feature/search-request-refactoring
# Conflicts:
#	core/src/main/java/org/elasticsearch/search/SearchService.java
2015-10-15 11:02:34 +01:00
Simon Willnauer 5b1ee8bd74 Fix GeoCenteriod Aggregation serialization 2015-10-15 09:57:47 +02:00
Robert Muir 9c109cae0d Fix SeccompTests bug on older kernels
This test failed only on a feature branch, because that feature branch has
a different build randomization script and is the only place
randomizing tests.security.manager (this test cannot run with it enabled).

On old kernels without TSYNC support, the test fails because (surprise to me) the thread that
runs the test is not the same thread that runs static initializers:
7571489190/randomized-runner/src/main/java/com/carrotsearch/randomizedtesting/RandomizedRunner.java (L573-L574)

To fix this test (its not an issue in practice, since we do this before creating threadpools),
we just record for testing purposes that we couldn't TSYNC, and re-run the whole thing for the test thread
in setUp(), failing if something goes wrong.

Also add a bunch of additional paranoia and narrow our defensive checks better here after reading
through more chrome bug reports: they don't impact us but those linux distros are too cowboy
with the backports and the spirit of the checks makes me feel better.
2015-10-15 01:40:32 -04:00
Jason Tedor 68561ce55c Merge pull request #14119 from jasontedor/index-meta-data-clean-up
Cleanup IndexMetaData
2015-10-14 19:29:08 -04:00
Nicholas Knize ceefe2e91a remove centroid calculation from GeoHashGridAggregation 2015-10-14 16:19:28 -05:00
Nicholas Knize b31d3ddd3e Adds geo_centroid metric aggregator
This commit adds a new metric aggregator for computing the geo_centroid over a set of geo_point fields. This can be combined with other aggregators (e.g., geohash_grid, significant_terms) for computing the geospatial centroid based on the document sets from other aggregation results.
2015-10-14 16:19:09 -05:00
Jason Tedor 88dd3256fb Cleanup IndexMetaData
This commit cleans up IndexMetaData. In particular, all duplicate
getters (X and getX) have been collapsed into one (getX). Further, the
number of shards and number of replicas settings are now parsed once
and saved off as fields.
2015-10-14 14:59:35 -04:00
Robert Muir 5d001d1578 Decentralize plugin security
* Add ability for plugins to declare additional permissions with a custom plugin-security.policy file and corresponding AccessController logic. See the plugin author's guide for more information.
* Add warning messages to users for extra plugin permissions in bin/plugin.
* When bin/plugin is run interactively (stdin is a controlling terminal and -b/--batch not supplied), require user confirmation.
* Improve unit test and IDE support for plugins with additional permissions by exposing plugin's metadata as a maven test resource.

Closes #14108

Squashed commit of the following:

commit cf8ace65a7397aaccd356bf55f95d6fbb8bb571c
Author: Robert Muir <rmuir@apache.org>
Date:   Wed Oct 14 13:36:05 2015 -0400

    fix new unit test from master merge

commit 9be3c5aa38f2d9ae50f3d54924a30ad9cddeeb65
Merge: 2f168b8 7368231
Author: Robert Muir <rmuir@apache.org>
Date:   Wed Oct 14 12:58:31 2015 -0400

    Merge branch 'master' into off_my_back

commit 2f168b8038e32672f01ad0279fb5db77ba902ae8
Author: Robert Muir <rmuir@apache.org>
Date:   Wed Oct 14 12:56:04 2015 -0400

    improve plugin author documentation

commit 6e6c2bfda68a418d92733ac22a58eec35508b2d0
Author: Robert Muir <rmuir@apache.org>
Date:   Wed Oct 14 12:52:14 2015 -0400

    move security confirmation after 'plugin already installed' check, to prevent user from answering unnecessary questions.

commit 08233a2972554afef2a6a7521990283102e20d92
Author: Robert Muir <rmuir@apache.org>
Date:   Wed Oct 14 05:36:42 2015 -0400

    Add documentation and pluginmanager support

commit 05dad86c51488ba43ccbd749f0164f3fbd3aee62
Author: Robert Muir <rmuir@apache.org>
Date:   Wed Oct 14 02:22:24 2015 -0400

    Decentralize plugin permissions (modulo docs and pluginmanager work)
2015-10-14 14:46:45 -04:00
javanna 736823163f Plugins: plugin script to set proper plugin bin dir attributes
This commit makes sure that the plugin script looks at user, group and permissions of the elasticsearch bin dir and copies them over to the plugin bin subdirectory, whatever they are, so that they get properly setup depending on how elasticsearch was installed. We also make sure that execute permissions are added for files (we already did this before).

Relates to #11016
Closes #14088
2015-10-14 14:59:38 +02:00
Britta Weber f07853b56c use lambdas 2015-10-14 11:36:02 +02:00
Britta Weber 4f536945de remove unneeded Exception and handling thereof 2015-10-14 11:32:57 +02:00
Simon Willnauer c133bec4bd Ensure searcher is release if wrapping fails
Today we leak an index searcher if we fail to wrap the seacher in
IndexShard. This commit ensures that the seacher is released if the wrapper
throws an exception.

This commit also restructures some test to be more atomic and only test a single
feature / attribute of the wrapper.
2015-10-14 10:44:57 +02:00
Simon Willnauer 5828796848 Merge pull request #14084 from s1monw/close_the_wrapper_only
Streamline top level reader close listeners and forbid general usage
2015-10-14 09:39:30 +02:00
Simon Willnauer db710c576f add javadocs 2015-10-14 09:28:05 +02:00
Simon Willnauer 7999027bf5 apply review comments 2015-10-14 09:19:02 +02:00
Jason Tedor 2e445d3ede Do not pollute Cache with failed futures 2015-10-13 22:14:13 -04:00
Jason Tedor b154c84306 Avoid deadlocks in Cache#computeIfAbsent
This commit changes the behavior of Cache#computeIfAbsent to not invoke
load for a key under the segment lock. Instead, the synchronization
mechanism to ensure that load is invoked at most once per key is
through the use of a future. Under the segment lock, we put a future in
the cache and through this ensure that load is invoked at most once per
key. This will not lead to the same deadlock situation as before
because a dependent key load on the same thread can not be triggered
while the segment lock is held.

Closes #14090
2015-10-13 21:15:28 -04:00
Simon Willnauer cac073dafa enforce that wrappers delegate core cache key and ban getCombinedCoreAndDeletesKey() entirely 2015-10-13 23:31:25 +02:00
Simon Willnauer ec60018e34 add comment why and when we have a leaf reader in the warmer 2015-10-13 21:06:20 +02:00
Simon Willnauer 0ead0faa1b fix typo 2015-10-13 20:51:43 +02:00
Simon Willnauer 1dca0e8f9b Add simple tests to ensure we can load and unload global ordinal with a wrapped reader 2015-10-13 20:51:10 +02:00
Britta Weber f7693b694b fix access denied for shard deletion with WindowsFS
We randomly use the WindowsFS mock file system to simulate that
windows does not delete files if they are opened by some other
process and instead gives you java.io.IOException: access denied.
In the tests we also check if the shard was deleted while it is
being deleted. This check loads the mata data of the index
and therefore might hold on to a file while the node
is trying to delete it and deletion will fail then.

Instead we should just check if the directory was removed.

closes #13758
2015-10-13 18:33:53 +02:00
Simon Willnauer e3f00e302c Add more pickyness to index warming and searcher wrappping
this commit also fixes a bug where we wramed a leaf reader in a top level context
which caused atomic segment readers to be used in our top level caches.
2015-10-13 17:21:46 +02:00
Simon Willnauer dac1799305 Cast DirectoryReader only when really requested 2015-10-13 17:21:46 +02:00
Simon Willnauer ba8de12429 remove unnecessary cast 2015-10-13 17:21:46 +02:00
Simon Willnauer bd5ac9ce1a enforce DirectoryReader when globals are loaded 2015-10-13 17:21:46 +02:00
Simon Willnauer d3436ff592 Streamline top level reader close listeners and forbid general usage
IndexReader#addReaderCloseListener is very error prone when it comes to
caching and reader wrapping. The listeners are not delegated to the sub readers
nor can it's implementation change since it's final in the base class. This commit
only allows installing close listeners on the top level ElasticsearchDirecotryReader
which is known to work an has a defined lifetime which corresponds to its subreader.
This ensure that cachesa re cleared once the reader goes out of scope.
2015-10-13 17:21:18 +02:00
jaymode 077a401c28 [TEST] do not wipe excluded templates
In #13606, the ability to exclude a template from being wiped was added but a call to
wipeTemplates() was not removed, so all index templates were still being removed.

This change removes the wipeTemplates() call in the wipe method so that only the
non-excluded templates are removed.
2015-10-13 09:59:32 -04:00
javanna 4d7d29f65b Plugins: plugin script to set proper plugin config dir attributes
Depending on how elasticsearch is installed, we have two scenarios to take into account that relate to user, group and permissions assigned to the config directory:

1) deb/rpm package: /etc/elasticsearch is root:elasticsearch 750 and the plugin script is run from root user
2) tar/zip archive: es config dir is most likely elasticsearch:elasticsearch and the plugin script is most likely run from elasticsearch user

When the plugin script copies over the plugin config dir within the es config dir, it should take care of setting the proper user, group and permissions, which vary depending on how elasticsearch was installed in the first place. Should be root:elasticsearch 750 if installed from a package, or elasticsearch:elasticsearch if installed from an archive.

This commit makes sure that the plugin script looks at user, group and permissions of the config dir and copies them over to the plugin config subdirectory, whatever they are, so that they get properly setup depending on how elasticsearch was installed in the first place. We also make sure that execute permissions are left untouched for files.

Relates to #11016
Closes #14048
2015-10-13 15:56:26 +02:00
Britta Weber 1634c8364e Merge pull request #14085 from brwe/fix-score-accuracy
fix numerical issue in function score query
2015-10-13 15:21:04 +02:00
Jason Tedor b7e09582ce Merge pull request #14087 from jasontedor/vle-integral-arrays
Add methods for variable-length encoding integral arrays
2015-10-13 09:12:10 -04:00
Robert Muir ceb969a13e Make PerThreadIDAndVersionLookup per-segment
Closes #14070

Squashed commit of the following:

commit ad5829e590cf6150763c31886e97d69976b7f02d
Author: Robert Muir <rmuir@apache.org>
Date:   Tue Oct 13 06:50:25 2015 -0400

    Add more tests for version map caching

commit 617333eefd6d4ddc99db491d0843827b1b5936b2
Author: Robert Muir <rmuir@apache.org>
Date:   Mon Oct 12 13:25:51 2015 -0400

    fix javadocs ref

commit 9626dd02e01a2676538e1071e302d882fc870837
Author: Robert Muir <rmuir@apache.org>
Date:   Mon Oct 12 13:23:16 2015 -0400

    make the version map cache per-segment
2015-10-13 09:00:04 -04:00
Yannick Welsch a550ebf381 Merge pull request #13998 from ywelsch/tests/transportmasternodeaction
Tests for TransportMasterNodeAction
2015-10-13 05:48:40 -07:00
Jason Tedor 2162172f30 Add methods for variable-length encoding integral arrays
This commit adds methods to serialize the elements of int and long
arrays using variable-length encodings. This can be useful for
serializing int and long arrays containing mostly non-negative “not
large” values in a compressed form.
2015-10-13 08:47:42 -04:00
Yannick Welsch c2df88a21d [TEST] Add tests for TransportMasterNodeAction
Closes #13998
2015-10-13 14:46:59 +02:00