Commit Graph

4485 Commits

Author SHA1 Message Date
Shay Banon 94539979c7 [TEST] make completion tests more resilient to delayed mapping
especially the tests that check for update of mapping, we need to make sure that the cluster is green so mappings won't get override, also, put mapping during index creation when possible
2014-07-09 22:19:06 +02:00
uboness 610900b781 Enables plugins to define default logging configuration for their needs.
- adds support for multiple logging configurations under the config dir (will pick up any logging.xxx in the config folder tree)
- plugins can now define a top level config directory that will be copied under es config dir and will be renamed after the plugin name (same as the support we have the plugin "bin" dirs)

 Closes #6802
2014-07-09 21:46:21 +02:00
Shay Banon 3e202b4343 Improve large bytes request handling by detecting content composite buffer
There is a special type of request that tries to not allocate another buffer when sending bytes request (used by the public cluster state action). With the new pages bytes reference support, the content can already be a composite channel buffer, take that into account when building the actual composite buffer that will be sent over the network
closes #6756
2014-07-09 21:40:15 +02:00
Shay Banon 8910e09beb Disable JSONP by default
By default, disable the option to use JSONP in our REST layer
closes #6795
2014-07-09 21:17:17 +02:00
Shay Banon b301132d7b [TEST] move more tests to assertBusy from awaitBusy 2014-07-09 21:16:23 +02:00
Shay Banon 386a14370a Upgrade to jackson core 2.4.1.1
Note, we had to disable the symbol overflow, since the many mapping case was tripping it
closes #6789
2014-07-09 17:49:51 +02:00
Areek Zillur 95a5eedd3c Merge pull request #6792 from areek/fix/6717
Remove Lucene's deprecated PatternAnalyzer
2014-07-09 11:18:51 -04:00
Valdis Rigdon 747fd38411 [Test] BackgroundIndexer uses the wrong logger
Closes #6781
2014-07-09 16:49:05 +02:00
Clinton Gormley d0441857cd Fix typo in Hunspell logging 2014-07-09 15:56:07 +02:00
Simon Willnauer 73b9d37064 Add v1.2.3 to Version.java 2014-07-09 15:02:18 +02:00
Shay Banon ecde4e0c8e Improve Settings#get lookup for camel case support
Today, if we miss on a get on setting, we try its camel case version. The assumption is that in our code, we never use camel case to lookup a setting, but we want to support camel case if the user provided one.
This can be expensive (#toCamelCase) when the get on the setting is done in a tight call, which is evident when running the allocation deciders as part of the reroute logic.
Instead of doing the camel case check on get, prepare an additional map that includes all the settings that are provided as came case, and try and lookup from it if needed.
closes #6765
2014-07-09 14:23:37 +02:00
Martijn van Groningen 9abb7c45b4 Store: Before removing shard physically from disk verify that another node in the cluster actually holds an active shard copy.
Closes #6692
2014-07-09 12:57:04 +02:00
Boaz Leskes 684e698627 [Code] Control whether MapperService docMapper iterator should contain DEFAULT_MAPPING
At the moment one can iterate the MapperService to go through all document mappers. This includes the document mapper of DEFAULT_MAPPING, which may be surprising and lead to unintended results. This commit removes the Iterable implementation and add a docMappers method that asks the caller to make an explicit choice

Closes #6793
2014-07-09 11:31:52 +02:00
Boaz Leskes af119dfdd9 [Engine] checkVersionMapRefresh shouldn't use indexWriter.getConfig(). We run it out of lock, the indexWriter may be closed..
Relates to #6443, #6786

Closes #6794
2014-07-09 10:43:28 +02:00
Areek Zillur 14af0cb0f3 Remove Lucene's deprecated PatternTokenizer
Instead of using the PatternTokenizer, the functionality was replicated by using Lucene's StopFilter, PatterTokenizer and LowerCaseFilter

Closes #6717
2014-07-08 21:39:39 -04:00
Simon Willnauer 57cd8f765f [ENGINE] Prevent NPE if engine is closed while version map is checked
We check if the version map needs to be refreshed after we released
the readlock which can cause the the engine being closed before we
read the value from the volatile `indexWriter` field which can cause an
NPE on the indexing thread. This commit also fixes a potential uncaught
exception if the refresh failed due to the engine being already closed.

Relates to #6443
Closes #6786
2014-07-09 00:22:31 +02:00
Shay Banon b97b670011 add more options to many mappings test 2014-07-08 23:46:33 +02:00
Shay Banon c9a46978e1 Remove intern calls on FieldMapper#Names
remove internal callas on FieldMappers#Names, we properly reuse FieldMapper, so there is no need to try and call intern in order to reuse the names. This can be heavy with many fields and continuous mapping parsing.
closes #6747
2014-07-08 20:17:48 +02:00
Shay Banon 5643563730 Add missing pre built analysis components
closes #6770
2014-07-08 19:54:05 +02:00
Shay Banon bb92d46163 [TEST] move tribe tests to use assertBusy 2014-07-08 19:06:59 +02:00
Shay Banon 10030a63cc Add assertBusy helper test method
We use awaitBusy in our tests, the problem is that we have to check if it awaited or not, and then try and keep around somehow more info around why the predicate failed and a timeout happened.
The idea of assertBusy is to allow to simply write "regular" test code, and if the test code trips, it will busy wait till a timeout. This allows us to keep around the assertion information and properly throw it for information that is inherently kept in the failure itself.
2014-07-08 18:58:10 +02:00
mikemccand 7335b5db22 Translog: change flush_threshold_ops to unlimited by default, so we only flush by byte size by default
If you are indexing tiny documents then the previous default (5000)
was too low, causing excessive fsyncs with high indexing rates.  With
this change we now only flush by byte size (200 MB) by default for
better indexing performance for tiny documents.

Closes #6783
2014-07-08 12:42:17 -04:00
mikemccand a8417a7de3 Core: trigger refresh when the live version map is using too much RAM
When refresh_interval is long or disabled, and indexing rate is high,
it's possible for live version map to use non-trivial amounts of RAM.
With this change we now trigger a refresh in such cases to clear the
version map so we don't use unbounded RAM.

Closes #6443
2014-07-08 12:07:48 -04:00
Colin Goodheart-Smithe c85133c857 Aggregations: Aggregation names can now include dot
Aggregation name are now able to use any character except '[', ']', and '>". Dot syntax may still be used to reference values (e.g. in the order field) but may only defence the value directly beneath the last aggregation in the list. more complex structures will need to be accessed using the aggname[value] syntax

Closes #6702
2014-07-08 15:05:46 +01:00
Boaz Leskes c9b0816b29 [Discovery] verify connect when sending a rejoin cluster request
When a master receives a cluster state from another node, it compares the local cluster state with the one it got. If the local one has a higher version, it sends a JoinClusterRequest to the other master to tell it step down. Because our network layer is asymmetric, we need to make sure we're connected before sending.

Closes #6779
2014-07-08 14:41:53 +02:00
javanna 8dedbd01df Core: don't replace indices within the ActionRequest with the concrete ones, and make sure check blocks is executed on concrete indices
Concrete indices is now called multiple times when needed instead of changing what's inside the incoming request with the concrete indices. Ideally we want to keep the original aliases or indices or wildcard expressions in the request.

Also made sure that the check blocks is done against the concrete indices, which wasn't the case for delete index, delete mapping, open index, close index, types exists and indices exists.

Closes #6694
Closes #6777
2014-07-08 14:18:26 +02:00
Boaz Leskes caf11ff2fb Revert "[Discovery] immediately start Master|Node fault detection pinging"
In #6706 we change the master validation to start pining immediately after a new master as ellected or a node joined. The idea is to have a quicker response to failures. This does however create a problem if the new master has yet fully processed it's ellection and responds to the ping with a NoLongerMasterException. This causes the source node to remove the current master and ellect another, only to find out it's not a master either and so forth. We are moving this change to the feature/improve_zen branch, where the improvements we made will cause the situation to be handled properly.

This reverts commit ae16956e07.
2014-07-08 13:35:08 +02:00
Shay Banon 6a4f61a7d2 [TEST] more consistent toString on cluster state, print with assertTimeout 2014-07-08 13:09:16 +02:00
Boaz Leskes 83770c2583 [Test] Revert temporary fixes for update mapping on recovery issue
This reverts:
"Test: Temporarily change delete/put_mapping to wait for green": commit e408f8f638c2dd97a3ec86c8a9ac940f43ab37a0.
"[TEST] wait for green to update mapping": commit b3641a2ee6eb23318d49f5f04b39149e70c2b65b.
2014-07-07 22:27:25 +02:00
Boaz Leskes 867d88795b [Recovery] only send mapping updates to master if needed
The change added in #6762 helps making sure the pending mapping updates are processed on all nodes to prevent moving shards to nodes which are not yet fully aware of the new mapping. However it introduced a racing condition delete_mapping operations, potentially causing a type to be added after it's deletion. This commit solves this by only sending a mapping update if the mapping source has actually changed.

Closes #6772
2014-07-07 21:39:22 +02:00
Shay Banon 135404fffc [TEST] wait for green to update mapping
before we update the mapping, make sure the index is green, so a delayed recovery update mapping will not override the mapping itself
2014-07-07 18:42:20 +02:00
Shay Banon 807b2409ee Don't update default mapping on phase2 recovery
the default mapping is not merged, but updated in place, and only put mapping API can change it, no need to make sure it has been properly updated on the master. This can cause conflicts when a put mapping for it happens at the same time.
closes #6771
2014-07-07 18:40:05 +02:00
mikemccand 15b81c91f7 Core: remove per-ID locking when ID was auto-generated
When we know the ID for the document we are about to index was
auto-generated, we don't need to acquire/release the per-ID lock,
which might provide small speedups during highly concurrent indexing.

Closes #6584
2014-07-07 11:35:33 -04:00
Clinton Gormley f97ff704cf Query DSL: Improved explanation for match_phrase_prefix
The match_phrase_prefix provided the same explanation as the match_phrase
query. There was no indication that the last term was run as a prefix
query.

This change marks the last term (or terms if there are multiple terms
in the same position) with a *

Closes #2449
2014-07-07 14:42:31 +02:00
Boaz Leskes 7f5f4e842e [Relocation] process pending mapping update in phase 2
During phase1 we copy over all lucene segments. These may refer to mapping updates that are still queued up to be sent to master. We must make sure those pending updates are processed before completing the relocation.

Relates to #6648

Closes #6762
2014-07-07 13:21:16 +02:00
Lee Hinman 7023caa1a1 Allow primaries that have never been allocated to be allocated if under the low watermark
Fixes #6196
2014-07-07 11:48:11 +02:00
Shay Banon b471aeb24c Call callback on actual mapping processed
only callback the registered callback listeners when mapping have actually been processed...
closes #6748
2014-07-07 09:42:05 +02:00
Shay Banon 8d793391da [TEST] wait for threads to finish writing before checking
we need to make sure we wait for all threads to finish executing, since there might still be a thread around even post await (i.e. just starting) performing updates
2014-07-06 16:08:09 +02:00
Shay Banon 7ca296987d [TEST] remove repeat lefover... 2014-07-06 12:24:16 +02:00
Shay Banon 6e99448620 [TEST] test didn't take into account other cluster service tasks
The pending tests on an actual node should take into account that other tasks might be executing on that node, thus failing when it happens
2014-07-06 12:23:50 +02:00
Shay Banon 045ce097c9 [TEST] only mark the event as processed when its out of its execution 2014-07-05 19:08:31 +02:00
Britta Weber 2a69ae2f0d Add license header to ManyMappingsBenchmark.java 2014-07-05 18:10:18 +02:00
Shay Banon 1d860f70ca Improve pending api to include current executing class
the pending tasks api will now include the current executing tasks (with a proper marker boolean flag)
this will also help in tests that wait for no pending tasks, to also wait till the current executing task is done
closes #6744
2014-07-05 17:40:52 +02:00
Shay Banon c8e553054b Improve performance for many new fields introduction in mapping
When we have many new fields keep being introduced, the immutable open map we used becomes more and more expensive because of its clone characteristics, and we use it in several places.

The usage semantics of it allows us to also use a CHM if we want to, but it would be nice to still maintain the concurrency aspects of volatile immutable map when the number of fields is sane.

Introduce a new map like data structure, that can switch internally to CHM when a certain threshold is met.

Also add a benchmark class to exploit the many new field mappings use case, which shows significant gains by using this change, to a level where mapping introduction is no longer a significant bottleneck.
closes #6707
2014-07-05 17:39:39 +02:00
Simon Willnauer a9abf18235 [TEST] Close threadpool once test searchcontext is released 2014-07-05 15:20:46 +02:00
Simon Willnauer 10cfc2fa0b [QUERY] Remove Queries#optimizeQuery(...)
This method tires to optimize boolean queries if there is only
one clause. Yet BooleanQuery already does that internally This
optimization is unneeded.

Closes #6743
2014-07-05 13:44:24 +02:00
Shay Banon d5dd9896c8 [TEST] also assert that put mapping is ack'ed 2014-07-05 11:24:16 +02:00
Shay Banon 4baf9df68e [TEST] wait for no pending tasks so processed all mappings 2014-07-05 11:23:10 +02:00
Boaz Leskes 536930c751 [Logging] added trace logging to TransportShardSingleOperationAction
And enabled them on SimpleRecoveryTests.testSimpleRecovery
2014-07-04 21:10:52 +02:00
David Pilato f0ad096bc4 Removing plugin does not fail when plugin dir is read only
If you try to remove a plugin in read only dir, you get a successful result:

```
$ bin/plugin --remove marvel
-> Removing marvel
Removed marvel
```

But actually the plugin has not been removed.

When installing, if fails properly:

```
$ bin/plugin -i elasticsearch/marvel/latest
-> Installing elasticsearch/marvel/latest...

Failed to install elasticsearch/marvel/latest, reason: plugin directory /usr/local/elasticsearch/plugins is read only
```

This change throw an exception when we don't succeed removing the plugin.

Closes #6546.
2014-07-04 17:29:18 +02:00
Martijn van Groningen f936283d65 [TEST] Ensure scores are consistent. 2014-07-04 17:18:38 +02:00
Simon Willnauer c4c2796bd9 [TEST] mute test - working on a fix 2014-07-04 16:33:41 +02:00
Chris Earle 312eb2b8b6 PluginManager: tests for missing plugin name when passing --url
Adding code to test for unset plugin names to fail fast with descriptive error messages. Also simplified the series of `if` statements checking for the commands by using a `switch` (now that it's using Java 7), added tests, and updated random exceptions with the up-to-date flag names (e.g., "--verbose" instead of "-verbose").

Closes #5976.
Closes #6013.
2014-07-04 16:18:52 +02:00
Shay Banon 04c573104f make sure we use the new analyzer wrapper on 4.10 2014-07-04 16:06:47 +02:00
Simon Willnauer 1e0506b6a0 [TEST] Reset all cluster if a test hit a failure
Closes #6734
2014-07-04 15:23:12 +02:00
Martijn van Groningen 63852a2c44 Added licence header 2014-07-04 15:11:22 +02:00
Martijn van Groningen 730b83c03c The query string cache can't return the same instance, since Query is mutable changing the query else where in the execution path changes the instance in the cache too.
Instead the query parser cache should return a cloned instances.

Closes #2542
Closes #6733
2014-07-04 15:04:26 +02:00
Simon Willnauer 80617612cb [TEST] Order of the results is not important in this test 2014-07-04 14:29:49 +02:00
Simon Willnauer 9f5f11c6a2 [TEST] use existing client that is already in the cluster to wait for joining node 2014-07-04 12:18:03 +02:00
Simon Willnauer 1493ece094 [TEST] assert search results before comparing the results - shards / indices might be missing 2014-07-04 11:42:21 +02:00
Simon Willnauer c6623877c9 [Query] QueryParser can return null from a query
This causes a NPE since XContentStructure checks if the query is null
and takes this as the condition to parse from the byte source which is
actually null in that case.

Closes #6722
2014-07-04 10:52:06 +02:00
Simon Willnauer a3d5cdcda8 [TEST] Wait for yellow since some shards might not be started
In this test we only index a handful of docs so if we have more shards
than docs we might fail on the `assertSearchResult` since not all shards
are started but results are just fine.
2014-07-04 09:53:48 +02:00
Shay Banon 5249005578 More resource efficient analysis wrapping usage
Today, we take great care to try and share the same analyzer instances across shards and indices (global analyzer). The idea is to share the same analyzer so the thread local resource it has will not be allocated per analyzer instance per thread.
The problem is that AnalyzerWrapper keeps its resources on its own per thread storage, and with per field reuse strategy, it causes for per field per thread token stream components to be used. This is very evident with the StandardTokenizer that uses a buffer...
This came out of test with "many fields", where the majority of 1GB heap was consumed by StandardTokenizer instances...
closes #6714
2014-07-03 21:03:08 +02:00
Brusic 388fddb3d9 Fix github download link when using specific version 2014-07-03 15:40:16 +02:00
Martijn van Groningen 7fbfbabfd3 [TEST] Include mapping in failure 2014-07-03 14:54:20 +02:00
Boaz Leskes ae16956e07 [Discovery] immediately start Master|Node fault detection pinging
After a node joins the clusters, it starts pinging the master to verify it's health. Before, the cluster join request was processed async and we had to give some time to complete. With  #6480 we changed this to wait for the join process to complete on the master. We can therefore start pinging immediately for fast detection of failures. Similar change can be made to the Node fault detection from the master side.

Closes #6706
2014-07-03 14:51:11 +02:00
Simon Willnauer f22e51ae81 [TEST] only call TestCluster#afterTest() if cluster was successfully initialized 2014-07-03 14:42:08 +02:00
Simon Willnauer 0475a052b0 [TEST] disable BWC tests for version < 1.1.0 2014-07-03 14:42:08 +02:00
Simon Willnauer 6d2077b0a3 [TEST] Split up random bulks more often and also if the document set is smallish 2014-07-03 13:56:31 +02:00
Boaz Leskes 7beac4ddbf [Discovery] Fault detection should also check cause exceptions for disconnects
The change introduced in #6686 checks for ConnectionTransportException during pinging. However, transport layer wraps it in  SendRequestTransportException
2014-07-03 13:42:53 +02:00
Simon Willnauer 95b6822f46 [TEST] Exclude SORANI analyzer if compatibility version is < 1.3.0 2014-07-03 13:16:19 +02:00
Simon Willnauer 97793358ea [TEST] Wait for cluster consistency before tests starts 2014-07-03 11:56:05 +02:00
Robert Muir b9a09c2b06 Analysis: Add additional Analyzers, Tokenizers, and TokenFilters from Lucene
Add `irish` analyzer
Add `sorani` analyzer (Kurdish)

Add `classic` tokenizer: specific to english text and tries to recognize hostnames, companies, acronyms, etc.
Add `thai` tokenizer: segments thai text into words.

Add `classic` tokenfilter: cleans up acronyms and possessives from classic tokenizer
Add `apostrophe` tokenfilter: removes text after apostrophe and the apostrophe itself
Add `german_normalization` tokenfilter: umlaut/sharp S normalization
Add `hindi_normalization` tokenfilter: accounts for hindi spelling differences
Add `indic_normalization` tokenfilter: accounts for different unicode representations in Indian languages
Add `sorani_normalization` tokenfilter: normalizes kurdish text
Add `scandinavian_normalization` tokenfilter: normalizes Norwegian, Danish, Swedish text
Add `scandinavian_folding` tokenfilter: much more aggressive form of `scandinavian_normalization`
Add additional languages to stemmer tokenfilter: `galician`, `minimal_galician`, `irish`, `sorani`, `light_nynorsk`, `minimal_nynorsk`

Add support access to default Thai stopword set "_thai_"

Fix some bugs and broken links in documentation.

Closes #5935
2014-07-03 05:47:49 -04:00
Simon Willnauer 9ddfaf3aaf [TEST] Expose `tests.filter` for elasticsearch tests.
`-Dtests.filter` allows to pass filter expressions to the elasticsearch
tests. This allows to filter test annotaged with TestGroup annotations
like @Slow, @Nightly, @Backwards, @Integration with a boolean expresssion like:

 * to run only backwards tests run:
     `mvn -Dtests.bwc.version=X.Y.Z -Dtests.filter="@backwards"`
 * to run all integration tests but skip slow tests run:
     `mvn -Dtests.filter="@integration and not @slow"
 * to take defaults into account ie run all test as well as backwards:
     `mvn -Dtests.filter="default and @backwards"

This feature is a more powerful alternative to flags like
`-Dtests.nighly=true|false` etc.

Closes #6703
2014-07-03 11:40:49 +02:00
Simon Willnauer 38e9942bd6 [TEST] Stabelize BWC tests for version < 1.1.0 2014-07-03 11:12:43 +02:00
Boaz Leskes 6e9a1f82b6 [Tests] remove bigArrays which were not fully release from watch list (and still fail the test)
This is to prevent future tests from failing due to these arrays
2014-07-03 11:10:44 +02:00
Shay Banon c1bc269de9 clean shard bulk mapping update to only use type
today we track both the index name and type for mapping updates in the shard bulk action, but we only work against on index in this level, so no need to track the index name itself
closes #6695
2014-07-03 00:38:52 +02:00
Simon Willnauer a960d17d09 [TEST] use pre 1.2.0 MATCH_ALL version if we test BWC for pre 1.2.0 2014-07-02 23:17:56 +02:00
Martijn van Groningen 20a55c05df Percolator: improve logging and cleanup try-catch statement for percolator query loading. 2014-07-02 22:36:02 +02:00
Martijn van Groningen 63eaec6f48 [TEST] Also do waitForConcreteMappingsOnAll() call for the .percolator type. 2014-07-02 22:30:51 +02:00
Simon Willnauer fd19b42cbb [TEST] Don't wait for relocations - the ensureYellow() call does that already 2014-07-02 22:13:44 +02:00
Boaz Leskes 8909a77724 [Discovery] Handle ConnectionTransportException during a Master/Node fault detection ping
Both the Master and Node fault detection register themselves to be notified when a node disconnects to be able to respond to it accordingly. As such, when a ConnectionTransportException was raised on a ping request, it was not handled as it is already handled somewhere else. However, this does introduce a racing condition, if the disconnect  happen during a period where there is no current master (minimum_master_node breach) at which time the fault detection is not active. In this case, we will only discover the disconnect error during the ping request, so we have to respond accordingly.

Closes #6686
2014-07-02 20:49:48 +02:00
Simon Willnauer 3b959706b3 [TEST] Take compatibility version into account for XContentType
randomization

We randomize the XContentType to test deriving the content type on all
APIs. Yet, BWC tests run against versions where CBOR wasn't around
this commit ensures we don't use CBOR when compatibility version is
less than `1.2.0`

Closes #6691
2014-07-02 20:06:03 +02:00
Martijn van Groningen 0ccc4c7c05 [TEST] Also wait for fields to have been applied in the mapping in cluster state during teh waitForConcreteMappingsOnAll call
The concrete DocMapper on the master will be updated before the mapping in the cluster state. The DocMapper is updated during the cluster update task. This can lead to occasional assertion failures on the mapping response, because that is based on the mapping the cluster state, which may not yet have been updated. (time window between the DocMapping is updated, but the mapping in the cluster state isn't)
2014-07-02 17:35:35 +02:00
Shay Banon ccd54dae2d better logic on sending mapping update new type introduction
when an indexing request introduces a new mapping, today we rely on the parsing logic to mark it as modified on the "first" parsing phase. This can cause sending of mapping updates to master even when the mapping has been introduced in the create index/put mapping case, and can cause sending mapping updates without needing to.
 This bubbled up in the disabled field data format test, where we explicitly define mappings to not have the update mapping behavior happening, yet it still happens because of the current logic, and because in our test we delay the introduction of any mapping updates randomly, it can get in and override updated ones.
closes #6669
2014-07-02 17:30:56 +02:00
Alexander Reelsen 4091162d91 Refactoring: Replaced string values with static constants
in TransportShardBulkAction after fixing an issue.
2014-07-02 12:37:40 +02:00
Alexander Reelsen b46d017e5c Bulk API: Fix return of wrong request type on failed updates
In case an update request failed (for example when updating with a
wrongly formatted date), the returned index operation type was index
instead of update.

Closes #6630
2014-07-02 12:37:39 +02:00
Boaz Leskes 7119ffa7bc IndexingMemoryController should only update buffer settings of recovered shards
At the moment the IndexingMemoryController can try to update the index buffer memory of shards at any give moment. This update involves a flush, which may cause a FlushNotAllowedEngineException to be thrown in a concurrently finalizing recovery.

Closes #6642, closes #6667
2014-07-02 12:23:10 +02:00
Adrien Grand b0c21d751d [TEST] Fix SimpleDeleteMappingTests.
The failure was hard to reproduce but it looked to me like dynamic mapping
updates were overriding the delete mappings request.
2014-07-02 12:12:04 +02:00
Adrien Grand 356349599f [TEST] Fix PercolatorTests to wait for mappings on master. 2014-07-02 11:51:58 +02:00
Alexander Reelsen 16fe44c7ec JAVA API: Fix source excludes setting if no includes were provided
Due to a bogus if-check in SearchSourceBuilder.fetchSource(String include, String exclude)
the excludes only got set when the includes were not null. Fixed this and added some
basic tests.

Closes #6632
2014-07-02 11:48:05 +02:00
Simon Willnauer dbd372cd61 [TEST] Added IntegrationTest to reproduce #6614 2014-07-02 11:45:58 +02:00
Simon Willnauer 06918d547a [TEST] Wait for yellow after enable allocation on all nodes in BWC tests 2014-07-02 11:38:52 +02:00
Adrien Grand e76eb228b2 [TEST] Fix IndexLookupTests.testCallWithDifferentFlagsFails. 2014-07-02 10:09:29 +02:00
Adrien Grand 309a284e8d [TEST] Fix failure in SearchFieldsTests.testUidBasedScriptFields.
Sorting fails on unmapped fields so the new propagation delay of the mappings
exposed this issue. I added explicit mappings as part of index creation to fix it.
2014-07-02 09:40:49 +02:00
Adrien Grand a96f9a7c83 Templates: GET templates doesn't honor the `flat_settings` parameter.
Close #6671
2014-07-02 08:42:31 +02:00
Igor Motov 67882d78aa [TEST] Remove RANDOM_NO_DELETE_OPEN_FILE and RANDOM_PREVENT_DOUBLE_WRITE settings from snapshot/restore tests 2014-07-01 15:55:53 -04:00
Shay Banon 2b1823cf02 wait for mapping updates during local recovery
when the primary shard is recovering its translog, make sure to wait for new mapping introductions till the mappings have been updated on the master before finalizing the recovery itself
also, this change performs the mapping updates in a more optimized manner by batching the types to change into a single set and sending after the translog has been replayed

also, remove the wait for mapping on master in the local state tests since this new behavior covers it

closes #6666

remove waiting for mapping on master since we do it in recovery
2014-07-01 19:36:26 +02:00
Boaz Leskes 72d2ac1328 Better support for partial buffer reads/writes in translog infrastructure
Some IO api can return after writing & reading only a part of the requested data. On these rare occasions, we should call the methods again to read/write the rest of the data. This has cause rare translog corruption while writing huge documents on Windows.

Noteful parts of the commit:
- A new Channels class with utility methods for reading and writing to channels
- Writing or reading to channels is added to the forbidden API list
- Added locking to SimpleFsTranslogFile
- Removed FileChannelInputStream which was not used

Closes #6441 , #6576
2014-07-01 19:11:36 +02:00
Martijn van Groningen 5668b1cfc5 Core: cancel entire recovery if shard closes on target node during the recovery operations.
Closes #6645
2014-07-01 18:16:41 +02:00
Simon Willnauer fd1d02fd07 [TEST] Prevent usage of System Properties in the InternalTestCluster
All settings should be passes as settings and the enviroment should not
influence the test cluster settings. The settings we care about ie.
`es.node.mode` and `es.logger.level` should be passed via settings.
This allows tests to override these settings if they for instance need
`network` transport to operate at all.

Closes #6663
2014-07-01 18:05:44 +02:00
Simon Willnauer c9b7bec3cc [INDEX] Ensure `index.version.created` is consistent
Today `index.version.created` depends on the version of the master
node in the cluster. This is potentially causing new features to be
expected on shards that didn't exist when the index was created.
There is no notion of `where was the shard allocated first` such that
`index.version.created` can't be reliably used as a feature flag.

With this change the `index.version.created` can be reliably used to
determin the smallest nodes version at the point in time when the index
was created. This means we can safely use certain features that would
for instance require reindeing and / or would not work if not the
entire index (all shards and segments) have been created with a certain
version or newer.

Closes #6660
2014-07-01 18:00:13 +02:00
Igor Motov f14edefc9d [TEST] Fix possible race condition in checksum name generator
When three threads are trying to write checksums at the same time, it's possible for all three threads to obtain the same checksum file name A. Then the first thread enters the synchronized section, creates the file with name A and exits. The second thread enters the synchronized section, checks that A exists, creates file A+1 and exits the critical section. Then it proceeds to clean up  and deletes all checksum files including A. If it happens before the third thread enters the synchronized section, it's possible for the third thread to check for A and since it no longer exists create the checksum file A the second time, which triggers "file _checksums-XXXXXXXXXXXXX was already written to" exception in MockDirectoryWrapper and fails recovery.
2014-07-01 09:51:42 -04:00
Martijn van Groningen ec74a7e76f Core: Prevent non segment readers from entering the filter cache and the field data caches.
Percolator: Never cache filters and field data in percolator for the percolator query parsing part.

Closes #6553
2014-07-01 15:05:31 +02:00
Adrien Grand 2ed73bb4f7 [TEST] Improve reproducibility of mappings propagation delays related issues. 2014-07-01 13:31:54 +02:00
Martijn van Groningen 85bea22bc8 Core: The ignore_unavailable=true setting also ignores indices that are closed.
Closes #6471
Closes #6475
2014-07-01 13:09:24 +02:00
Shay Banon f0817c31d9 start mapping service earlier to be available for recovery 2014-07-01 11:39:26 +02:00
Adrien Grand 6a1e7b6ad0 [TEST] Fix ExistsMissingTests failures.
They were due to a combination of mappings propagation delays and the behavior
of MapperService.smartName(String) so mappings are now configured up-front.
2014-07-01 11:25:37 +02:00
Igor Motov 8a20bfcdd5 [TEST] Turn off double write check for restore 2014-06-30 23:12:29 -04:00
Igor Motov 2149a9403d Improve deletion of corrupted snapshots
Makes it possible to delete snapshots that are missing some of the metadata files. This can happen if snapshot creation failed because repository drive ran out of disk space.

Closes #6383
2014-06-30 21:03:46 -04:00
Igor Motov 1425e28639 Add ability to restore partial snapshots
Closes #5742
2014-06-30 20:18:02 -04:00
Shay Banon 46f1e30fa9 Recovery from local gateway should re-introduce new mappings
The delayed mapping intro tests exposed a bug where if a new mapping is introduced, yet not updated on the master, and a full restart occurs, reply of the transaction log will not cause the new mapping to be re-introduced.
closes #6659

add comment on the method
2014-07-01 01:53:44 +02:00
Shay Banon e8519084c9 [TEST] properly wait for mapping on master node
add helper method to do so, by not assuming that the mapping will exists right away by waiting for green or refreshing...
2014-06-30 23:11:23 +02:00
Shay Banon 5c5e13abce [TEST] properly wait for mappings when needed 2014-06-30 22:32:43 +02:00
Shay Banon 5273410be6 Update mapping on master in async manner
Today, when a new mapping is introduced, the mapping is rebuilt (refreshSource) on the thread that performs the indexing request. This can become heavier and heavier if new mappings keeps on being introduced, we can move this process to another thread that will be responsible to refresh the source and then send the update mapping to the master (note, this doesn't change the semantics of new mapping introduction, since they are async anyhow).
When doing so, the thread can also try and batch as much updates as possible, this is handy especially when multiple shards for the same index exists on the same node. An internal setting that can control the time to wait for batches is also added (defaults to 0).

Testing wise, a new support method on ElasticsearchIntegrationTest#waitForConcreteMappingsOnAll to allow to wait for the concrete manifestation of mappings on all relevant nodes is added. Some tests mistakenly rely on the fact that there are no more pending tasks to mean mappings have been updated, so if we see, timing related, failures down later (all tests pass), then those will need to be fixed to wither awaitBusy on the master for the new mapping, or in the rare case, wait for the concrete mapping on all the nodes using the new method.
closes #6648

allow to change the additional time window dynamically

better sorting on mappers when refreshing source
also, no need to call nodes info in test, we already have the node names

clean calls to mapping update to provide doc mapper and UUID always
also use the internal cluster support method to get the list of nodes an index is on

reverse the order to pick the latest change first

remove unused field

and fix constructor param

move to start/stop on mapping update action

randomize INDICES_MAPPING_ADDITIONAL_MAPPING_CHANGE_TIME
2014-06-30 22:08:39 +02:00
Lee Hinman 761ef5d9f1 Wrap groovy script exceptions in a serializable Exception object
Fixes #6598
2014-06-30 16:50:34 +02:00
Shay Banon c9ff9a6930 [TEST] Randomize netty worker and connection parameters
Try and push our system to a state where there is only a single worker, trying to expose potential deadlocks when we by mistake execute blocking operations on the worker thread
closes #6635
2014-06-30 14:57:36 +02:00
Boaz Leskes c907ce325e [Test] make recovery slow down in rerouteRecoveryTest aware of index size 2014-06-30 10:54:45 +02:00
Boaz Leskes a72c167be2 [Test] improved recovery slow down in rerouteRecoveryTest
only change recovery throttling to slow down recoveries. The recovery file chunk size updates are not picked up by ongoing recoveries. That cause the recovery to take too long even after the default settings are restored.

Also - change document creation to reuse field names in order to speed up the test.
2014-06-29 14:37:12 +02:00
Boaz Leskes bbc82e2821 [Test] add awaitFix to rerouteRecoveryTest 2014-06-29 09:55:03 +02:00
Boaz Leskes ca194594b3 Recovery API should also report ongoing relocation recoveries
We currently only report relocation related recoveries after they are done.

Closes #6585
2014-06-28 21:27:15 +02:00
Boaz Leskes 155620ed8e [Test] testRelocationWhileRefreshing should wait for the first shard to be started 2014-06-28 10:41:06 +02:00
Simon Willnauer 9ce66cb167 [TEST] Testcase for #6639 2014-06-28 09:12:25 +02:00
Simon Willnauer b2685f132a [TEST] Change es.node.mode default for tests to `local`
In order to speed up test execution we should run in local mode by
default. CI builds will still use network builds all the time.

Closes #6624
2014-06-27 11:57:34 +02:00
Simon Willnauer f0cfdc444f [STORE] Wrap RateLimiter rather than copy RateLimitedIndexOutput
We clone RateLimitedIndexOutput from lucene just to collect pausing
statistics we can do this in a more straight forward way in a delegating
RateLimiter.

Closes #6625
2014-06-27 11:35:13 +02:00
Shay Banon 79af3228ad Thread pool rejection status code should be 429
Thread rejection should return too many requests status code, and not 503, which is used to also show that the cluster is not available
 relates to #6627, but only for rejections for now
closes #6629
2014-06-27 11:15:16 +02:00
Shay Banon 4129bb6a4f Make sure we don't reuse arrays when sending and error back
We want to make sure recycling will not fail for any reason while trying to send a response back that is caused by a failure, for example, if we have circuit breaker on it (at one point), sending an error back will not be affected by it.
closes #6631
2014-06-27 11:12:35 +02:00
Shay Banon e559295228 [TEST] when the test fail, have the exception message as the reason
the test failed but couldn't repro (yet), at the very least, make sure we have the exception message as the reason, can help to track down the failure itself when it happens again
2014-06-27 09:16:51 +02:00
Simon Willnauer f7da6da73a [TEST] suppress sysout checks since CI runs with debug enabled 2014-06-26 19:10:20 +02:00
Robert Muir b55ad98d73 Upgrade to Lucene 4.9 (closes #6623) 2014-06-26 08:18:59 -04:00
Lee Hinman b43b56a6a8 Add a transformer to translate constant BigDecimal to double 2014-06-26 10:52:28 +02:00
Lee Hinman 50bb274efa Remove MVEL as a built-in scripting language 2014-06-26 10:33:28 +02:00
Boaz Leskes 2c2783875e Be more diligent about ThreadPools having names
Add a name parameter to what was the empty ThreadPool constructor. Assert if the the ThreadPool's setting doesn't contain a name.
2014-06-26 10:01:22 +02:00
Clinton Gormley 30c80319c0 Match query with operator and, cutoff_frequency and stacked tokens
If the match query with cutoff_frequency encounters stacked tokens,
like synonyms in the same position, it returns a boolean query instead
of a common terms query.  However, if the original operator was set
to "and", it was ignoring that and resetting the operator to "or".

In fact, if operator is "and" then there is little benefit in using
a common terms query as a must query is already
executed efficiently.
2014-06-25 17:53:43 +02:00
Andrew Raines 534b07a3fb [TEST] Add assertion failure messages 2014-06-25 16:22:20 +02:00
Lee Hinman 5c6d28240f Switch to Groovy as the default scripting language
This is a breaking change to move from MVEL -> Groovy
2014-06-25 12:15:12 +02:00
Lee Hinman 47856ec4cd Add sandboxing for GString-based method invocation 2014-06-25 12:09:32 +02:00
Shay Banon 342563a864 [LOG] better log message 2014-06-25 11:01:20 +02:00
Alexander Reelsen fd9744968f Internal: Made base64 decode parsing to detect more errors
The base64 did not completely check, if there were other characters
after the equals `=` sign. This PR adds some small additional checks.

Closes #6334
2014-06-24 13:01:11 +02:00
Martijn van Groningen e12025f749 [TEST] Improved logging for replica operation failures 2014-06-23 09:28:41 +02:00
Boaz Leskes 3d6d2e700a [Test] testGetFields_complexField should wait for a green cluster
Waiting for ongoing recoveries was not good enough as it can run before the  master finishing processing the started events of primary shards, causing the recovery response to be erroneously empty
2014-06-21 20:15:13 +02:00
Shay Banon 0e83615496 [Test] Use no failures, shard might not have been initialize yet 2014-06-21 12:43:14 +02:00
Boaz Leskes 08ca51d7b6 [TEST] fix a NPE in verifyThreadNames which may happen if thread finishes during sampling 2014-06-21 10:31:45 +02:00
Shay Banon 0d66d3779e Fix optional default script loading
Groovy is optional as a dependency in the classpath, make sure we properly detect when its not at the right time to disable it
closes #6582
2014-06-21 00:27:15 +02:00
Martijn van Groningen 812972ab0e [TEST] Move the waiting for pending tasks to helper methods and let the percolator and update mapping test use these helper methods. 2014-06-20 23:44:33 +02:00
Martijn van Groningen 11251bca92 [TEST] Verify that all pending tasks are rely executed on *all* nodes. 2014-06-20 23:12:52 +02:00
Martijn van Groningen 73e4a9b3f7 Fixed NPE in recovery api by serializing the recovery type in StartRecoveryRequest.
Closes #6190
2014-06-20 22:09:46 +02:00
javanna f16451a446 Refactored AckedClusterStateUpdateTask & co. to remove code repetitions in subclasses
Made AckedClusterStateUpdateTask an abstract class instead of an interface, which contains the common methods.
Also introduced the AckedRequest interface to mark both AcknowledgedRequest & ClusterStateUpdateRequest so that the different ways of updating the cluster state (with or without a MetaData*Service) can share the same code.
Removed ClusterStateUpdateListener as we can just use its base class ActionListener instead.

Closes #6559
2014-06-20 20:14:40 +02:00
Lee Hinman 2708e453ac Re-shade MVEL as a dependency 2014-06-20 11:28:50 +02:00
Lee Hinman c70f6d0171 Add Groovy as a scripting language, add sandboxing for Groovy
Sandboxes the groovy scripting language with multiple configurable
whitelists:

`script.groovy.sandbox.receiver_whitelist`: comma-separated list of string
classes for objects that may have methods invoked.
`script.groovy.sandbox.package_whitelist`: comma-separated list of
packages under which new objects may be constructed.
`script.groovy.sandbox.class_whitelist` comma-separated list of classes
that are allowed to be constructed.

As well as a method blacklist:

`script.groovy.sandbox.method_blacklist`: comma-separated list of
methods that are never allowed to be invoked, regardless of target
object.

The sandbox can be entirely disabled by setting:

`script.groovy.sandbox.enabled: false`
2014-06-20 10:20:16 +02:00