Commit Graph

2526 Commits

Author SHA1 Message Date
Yannick Welsch 33ca2ec597 Merge pull request #14222 from ywelsch/fix/refactor-transport-master-node-action
Refactor retry logic for TransportMasterNodeAction
2015-11-09 17:59:16 +01:00
Yannick Welsch 0575744a39 Refactor retry logic for TransportMasterNodeAction
- Same as for TransportInstanceSingleOperationAction and TransportReplicationAction, onClusterServiceClose consistently throws a NodeClosedException now.
- Added retry logic if master could not publish cluster state or stepped down before publishing (ZenDiscovery). The test IndexingMasterFailoverIT shows the issue.
- Simplified retry logic by moving bits from different places into shared retry method.
  - Removed boolean flag retrying that aborted retrying after a single master node change (now we retry until timeout).
  - Two existing predicates that deal with master node changes unified in a single predicate masterNodeChangedPredicate

Closes #14222
2015-11-09 17:56:18 +01:00
Adrien Grand d6d7af0a6c Upgrade to lucene-5.4.0-snapshot-1712973. 2015-11-09 15:53:27 +01:00
javanna 43b729f34c [TEST] test query and search source parsing from different XContent types
We used to test only json parsing as we relied on QueryBuilder#toString which uses the json format. This commit makes sure that we now output the randomly generated queries using a random format, and that we are always able to parse them correctly.

This revealed a couple of issues with binary objects that haven't been migrated yet to be structured Writeable objects. We used to keep them in the format they were sent while parsing, which led to problems when printing them out as we expected them to always be in json format. Also we can't compare different BytesReference objects that hold the same content but in different formats (unless we want to parse them as part of equal and hashcode, doesn't seem like a good idea) and verify that we have parsed the right objects if they can be different formats. The fix is to always keep binary objects in json format. Best fix would be not to have binary objects, which we'll get to once we are done with the search refactoring.

Closes #14415
2015-11-09 15:09:27 +01:00
javanna 10ddd691a3 Internal: move to lucene BoostQuery
Latest version of lucene deprecated Query#setBoost and Query#getBoost which made queries effectively immutable. Those methods need to be replaced with `BoostQuery` that wraps any query that needs boosting.

This commit replaces usages of setBoost with BoostQuery and adds it to forbidden-apis for prod code.

Usages of `getBoost` are only partially removed, as some will have to stay for backwards compatibility.

Closes #14264
2015-11-09 15:01:35 +01:00
Simon Willnauer 7b5e323ec0 add IT for #14387 2015-11-09 15:00:56 +01:00
Robert Muir 102e25413d Merge pull request #14605 from rmuir/migrate-mapper-attachments
Migrate mapper attachments plugin to main repository
2015-11-09 08:55:29 -05:00
Simon Willnauer 219fe8f30f apply @bleskes review changes 2015-11-09 12:58:11 +01:00
Daniel Mitterdorfer 1c5b0b3c5b Merge branch 'pr/14611' 2015-11-09 12:08:56 +01:00
Adrien Grand f400f58132 Merge pull request #14472 from jpountz/fix/simplify_xcontent_detection
Simplify XContent detection.
2015-11-09 12:02:39 +01:00
Adrien Grand c350a3dfae Simplify XContent detection.
Currently we duplicate the logic for BytesReferences and InputStreams.
2015-11-09 12:00:03 +01:00
Martijn van Groningen 72e9bd8506 Merge pull request #14597 from wbowling/tophitsbuilder-addfield
Put method addField on TopHitsBuilder
2015-11-09 17:40:13 +07:00
Camilo Díaz Repka d795ce3b6e XContentFactory.xContentType: allow for possible UTF-8 BOM for JSON XContentType
Fixes #14442
2015-11-09 11:19:54 +01:00
Robert Muir 0de503b34b fixup issues with 32-bit jvm
If you run tests under a 32-bit jvm, you will get a test failure in IndexStoreTests,
the logic there is wrong in the case of 32-bit (its NIOFSDirectory on linux).

Also if mlockall fails, you'll see huge bogus values (because of use of `long` instead of `NativeLong`)

finally add seccomp support for 32 bit too, and clean up all its `long` usage as well.
2015-11-08 21:08:08 -05:00
andrejserafim 2bd353d72d replacing run.bat and run.sh with gradle run
run.sh and run.bat were calling out to the old maven build system.
This is no longer in place, so we've created new gradle tasks to
start an elasticsearch node from the current codebase.

fixed #14423
2015-11-08 17:07:19 +00:00
Simon Willnauer 47769cc4b4 add more logging to test for better readability 2015-11-08 12:43:24 +01:00
Simon Willnauer fa6a2932f5 Instead of relying on the in-flight number use a boolean flag on the
allocation to ensure that we skip rebalance if we have not processed
all pending shard / store fetches.
2015-11-08 12:40:05 +01:00
Robert Muir e88896e40e apply a few post-merge cleanups 2015-11-08 02:31:26 -05:00
Areek Zillur 6444194dae fix conflicts from merge 2015-11-07 18:22:28 -05:00
Areek Zillur d5198b326c fix comments and throw ElasticsearchException when we fail to report fst index size 2015-11-07 17:50:56 -05:00
Areek Zillur d37e011526 add query context builders 2015-11-07 17:50:56 -05:00
Areek Zillur 40022e2168 remove nocommit 2015-11-07 17:50:55 -05:00
Areek Zillur e87b4e00eb add back awaitfix tests 2015-11-07 17:50:55 -05:00
Simon Willnauer 6f9a486071 more parsers 2015-11-07 17:50:55 -05:00
Simon Willnauer f5560a3087 add parsers 2015-11-07 17:47:46 -05:00
Simon Willnauer 8911469e63 some basic cleanups 2015-11-07 17:46:28 -05:00
Areek Zillur 75d55e11ad cut over to using ObjectParser for context mappings 2015-11-07 17:46:27 -05:00
Areek Zillur 96c9849f5a added FuzzyOptionsBuilder javadocs and cleanups 2015-11-07 17:46:27 -05:00
Areek Zillur dd1c687ace Completion Suggester V2
The completion suggester provides auto-complete/search-as-you-type functionality.
This is a navigational feature to guide users to relevant results as they are typing, improving search precision.
It is not meant for spell correction or did-you-mean functionality like the term or phrase suggesters.

The completions are indexed as a weighted FST (finite state transducer) to provide fast Top N prefix-based
searches suitable for serving relevant results as a user types.

closes #10746
2015-11-07 17:46:27 -05:00
Robert Muir e06cae84f3 only allow code to bind to the user's configured port numbers/ranges
Random code shouldn't be listening on sockets elsewhere.

Today its the wild west, but we only need to grant access to what the user configured.

This means e.g. multicast plugin has to declare its intentions in its security.policy

Closes #14549
2015-11-07 12:22:12 -05:00
William Bowling 202a735d8f Put method addField on TopHitsBuilder 2015-11-07 17:15:02 +11:00
Robert Muir f03196193f Fix Build to correctly treat URLs and not leak a file handle.
Closes #14595

Squashed commit of the following:

commit d0b2b262e9dcdbc2aee163b9a84db082c8b5b96b
Author: Robert Muir <rmuir@apache.org>
Date:   Fri Nov 6 22:36:54 2015 -0500

    Switch to JarInputStream, to contain suppressforbidden. Also add a test that fails if path is not accessible (regardless of whether its a jar)

commit f99c1d240db23ceb2a06987b3bd69eae0229550b
Author: Robert Muir <rmuir@apache.org>
Date:   Fri Nov 6 22:16:16 2015 -0500

    remove leniency in i/o here

commit b160d4303ee81a8c9298729596ecbc893f5f8894
Author: Robert Muir <rmuir@apache.org>
Date:   Fri Nov 6 21:58:21 2015 -0500

    Fix Build to correctly treat URLs and to not leak a file handle
2015-11-06 22:40:58 -05:00
Ryan Ernst 59a1cda9bb Merge pull request #14592 from rjernst/eclipse_cycles
Build: Fix eclipse generation to add a core-tests projects
2015-11-06 11:55:47 -08:00
Ryan Ernst 548430072f Build: Fix eclipse generation to add a core-tests projects
Eclipse does not have the ability to differentiate test dependencies
from main dependencies. This causes what looks like a circular
dependency through test-framework. This change sets up an additional
core-tests project for eclipse only, which removes this problem.
2015-11-06 11:41:18 -08:00
Simon Willnauer 01ca95a648 Only allow rebalance operations to run if all shard store data is available
This commit prevents running rebalance operations if the store allocator is
still fetching async shard / store data to prevent pre-mature rebalance decisions
which need to be reverted once shard store data is available. This is typically happening
on rolling restarts which can make those restarts extremely painful.

Closes #14387
2015-11-06 20:18:01 +01:00
Nicholas Knize afaf96732a Add GeoPointV2 Field Mapping
This commit adds the abstraction layer to GeoPointFieldMapper needed to cut over to Lucene 5.4's new GeoPointField type while maintaining backward compatibility with 'legacy' geo_point indexes.
2015-11-06 13:14:04 -06:00
Jason Tedor 699c701b59 Handle shards assigned to nodes that are not in the cluster state
This commit addresses an issue in TransportBroadcastByNodeAction.
Namely, if in between a master leaving the cluster and a new one being
assigned, a request that relies on TransportBroadcastByNodeAction
(e.g., an indices stats request) is issued,
TransportBroadcastByNodeAction might attempt to send a request to a
node that is no longer in the local node’s cluster state.

The exact circumstances that lead to this are as follows. When the
master leaves the cluster and another node’s master fault detection
detects this, the local node will update its local cluster state to no
longer include the master node. However, the routing table will not be
updated. This means that in the preparation for sending the requests in
TransportBroadcastByNodeAction, we need to check that not only is a
shard assigned, but also that it is assigned to a node that is still in
the local node’s cluster state.

This commit adds such a check to the constructor of
TransportBroadcastByNodeAction. A new unit test is added that checks
that no request is sent to the master node in such a situation; this
test fails with a NullPointerException without the fix. Additionally,
the unit test TransportBroadcastByNodeActionTests#testResultAggregation
is updated to also simulate a master failure. This updated test also
fails prior to the fix.

Closes #14584
2015-11-06 12:09:30 -05:00
Yannick Welsch c6b41bc704 Introduce inner class AsyncSingleAction to store state used across retry invocations 2015-11-06 16:38:33 +01:00
Yannick Welsch 1c31845b7a Merge pull request #14535 from ywelsch/fix/bound-vs-publish-port
Port of publishAddress should match port of corresponding boundAddress
2015-11-06 10:17:05 +01:00
Yannick Welsch 1902c66aaf Port of publishAddress should match port of corresponding boundAddress
Closes #14535
Closes #14503
Closes #14514
Closes #14513
Closes #14476
2015-11-06 10:12:10 +01:00
Simon Willnauer 1bff08b2b3 [TEST] Add test only API that allows to pass the inactive time in NS directly
if we set the inactive time for the shard via API the entire test if fully time
dependent and might fail if we concurrently check if the shard is inactive
while the document we are indexing is in-flight.
2015-11-06 09:18:23 +01:00
Jason Tedor 54d2b5f3b6 Merge pull request #14564 from jasontedor/restore-build-properties
Restore build properties
2015-11-05 21:34:07 -05:00
Jason Tedor 8278c9887e Restore build properties
This commit restores the build properties provided in
org.elasticsearch.Build. This class previously obtained the build hash
and timestamp from a resource es-build.properties that was included in
the jar and produced by the Maven resources plugin. After the switch to
Gradle, the production of this file was lost and these build properties
defaulted to “NA” in all instances.

The most important place that the build hash is used is in the plugin
manager to determine the URL of staging artifacts for plugins.

The build hash is also used in several responses including the /_nodes
response and the response to HTTP GET requests on the root path.

These properties can now be obtained from the jar manifest as they are
currently placed there by the gradle-info plugin. However, only the
short hash is provided. We now read the manifest for these properties
and no longer provide the full hash in responses to HTTP GET requests
on the root path.
2015-11-05 21:30:04 -05:00
Simon Willnauer 46bec2785e [TEST] mark test awaitsfix 2015-11-05 22:20:23 +01:00
Nicholas Knize 86ae08fa88 Add support for Lucene 5.4 GeoPoint queries
This commit adds query support for Lucene 5.4 GeoPointField type along with backward compatibility for (soon to be) "legacy" geo_point indexes.
2015-11-05 12:21:27 -06:00
Simon Willnauer 99b61ef91c [TEST] use TRACE Logging for syncFlush tests 2015-11-05 18:37:26 +01:00
Simon Willnauer 4a686c9750 mark shard as active before tripper synced flush in test 2015-11-05 16:50:10 +01:00
Simon Willnauer cf0edeaa4f Mark failing test as awaits fix 2015-11-05 16:39:11 +01:00
Simon Willnauer b328e26160 Merge pull request #14518 from s1monw/simplify_index_level_services
Remove guice from the index level
2015-11-05 15:06:37 +01:00
Robert Muir fffafbfd4d Merge pull request #14274 from rmuir/broken_code
Add workaround for JDK-8014008
2015-11-05 08:24:04 -05:00
Simon Willnauer 94bed42213 Simplify plugin API and fix IndexService internal allocation 2015-11-05 13:16:35 +01:00
Simon Willnauer cf0179bf12 apply @rjernst review comments 2015-11-05 11:18:12 +01:00
Simon Willnauer 0dac6bfa86 fix return value 2015-11-05 11:18:11 +01:00
Simon Willnauer a4a0390ff6 Move inactiveTime into IndexShard out of IndexingMemoryController 2015-11-05 11:18:11 +01:00
Simon Willnauer 7d77f182e2 fix tests 2015-11-05 11:18:11 +01:00
Simon Willnauer a311491c8e decouple IndexingMemoryController from IndexShard 2015-11-05 11:18:11 +01:00
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