Commit Graph

2594 Commits

Author SHA1 Message Date
Shay Banon c3ecd6fd1b REST: Add newline to response when using pretty flag
closes #3748
relates to #3422
2013-09-20 14:55:35 +02:00
Alexander Reelsen 2624c90efb Using AbstractIntegrationTest in SimpleTTLTests and FunctionScorePluginTests 2013-09-20 13:36:50 +02:00
Simon Willnauer 30d7faeba2 Cut over more tests to AbstractIntegrationTest 2013-09-20 13:31:46 +02:00
Shay Banon b092a0dade use the same client and preference when failing 2013-09-19 18:58:07 +02:00
Luca Cavanna 46753122aa Log line set to TRACE
The default log level for the action package is DEBUG, we don't want to print out lines like this by default in our distribution.
2013-09-19 18:29:55 +02:00
Simon Willnauer 575d6b0321 Cleanup test classes and add Scope support for TestCluster
TestCluster can currently only be used in a globally shared scope.
This commit adds the ability to use the TestCluster in 3 different
scopes per test-suite. The scopes are 'Global', 'Suite' and 'Test'
where the cluster is shared across all tests, across all test methods or
not at all respectivly.
Subclasses of AbstractIntegrationTest (formerly AbstractSharedClusterTest)
can add an annotation if they need a different scope than Global (default):

```
  @ClusterScope(scope=Scope.Suite, numNodes=1)
```
This also allows to specify the number of shared nodes in that TestCluster
that are available when a test starts.

The cleanups in this commit include:

 - s/Elasticsearch/ElasticSearch/g on test classes
 - Move test classes in org.elasticsearch.test
2013-09-19 17:48:22 +02:00
Simon Willnauer de3cde3e1e Rename Engine#seacher() into Engine#acquireSearcher()
The name should reflect that the caller is responsible for
releaseing the searcher again.
2013-09-19 16:43:20 +02:00
Simon Willnauer 04deb80634 Add asserting searcher to track searcher references
This assertion module also injects an AssertingIndexSearcher that
checks if our queries are all compliant with the lucene specification
which is improtant for future updates and changes in the upstream project.
2013-09-19 16:21:45 +02:00
Shay Banon bb4f30c76c add explicit refresh post failure to test
log the hits post explicit refresh, and post explicit wait for green
2013-09-19 16:18:04 +02:00
Alexander Reelsen 8ab77651ad Added more information to assertion in completion suggest tests 2013-09-19 15:02:11 +02:00
Martijn van Groningen e68f99254b Make sure the transport response handler is invoked only once.
There was a small window of time where the transport response handler's handException method was invoked twice. As far as I can tell this happened when node disconnect event was processed just after the request was registered and between a "Node not connected" error was thrown. The TransportService#sendRequest method would invoke the transport response handler's handException method regardless if it was already invoked. This resulted that for one request failure, two retries were executed.

The mpercolate api has an assert that tripped when more than the expected shard level responses were returned. This was caused by the issue described above. For the a single shard level request we had multiple responses and this broke the the the total excepted responses. Also the reduce could be started prematurely, which resulted in an incorrect final response (e.g. total count being incorrect). For example: two shards in total, shard 0 gets reduces twice. The second shard 0 response gets in just before shard 1 response gets in. The reduce starts without shard 1 response.
2013-09-19 13:24:48 +02:00
Shay Banon 1581f25e27 Discovery to support a timeout waiting for other nodes to processing new cluster state
The master node processing changes to cluster state, and part of the processing is publishing the cluster state to other nodes. It does not wait for the cluster state to be processed on the other nodes before it moves on to the next cluster state processing job.

This is fine, we support out of order cluster state events using versioning, and nodes can handle those cases. It does lead though to non optimal API semantics. For example, when issuing cluster health, and waiting for green state, the master node will report back once the cluster is green based on its cluster state, but that mentioned "green" state might not have been received by all other nodes yet.

Add a discovery.zen.publish_timeout setting, and default it to 5s. This will give a best effort into making sure all nodes will process a cluster state within a window of time.

closes #3736
2013-09-19 13:09:24 +02:00
Luca Cavanna cf0c360f86 Prevented empty filters from causing NPE
Closes #3724
2013-09-18 20:29:01 +02:00
Simon Willnauer a26375ae25 Check if nodes have been shut down in TestCluster#beforeTest
The test cluster ignored randomly teared down nodes in tests.
This commit also adds some debug logging to the TestCluster#beforeTest
method.
2013-09-18 16:22:27 +02:00
Shay Banon 4eab186ce6 call ensureGreen instead of explicit call 2013-09-18 14:57:08 +02:00
Britta Weber 04c560ce9f GetActionTests: call ensureGreen() to get more meaningful debug output on failure 2013-09-18 14:33:02 +02:00
Britta Weber 995c55b861 call ensureGreen() to get more meaningful debug output on failure 2013-09-18 14:15:56 +02:00
Shay Banon 84242c208e improve failure message when timing out on green/yellow 2013-09-18 13:38:44 +02:00
Luca Cavanna 15cb0fd745 Removed wrong assertion from OpenCloseIndexTests
If a request hasn't been acknowledged, there's no guarantee for any node to hold the up-to-date cluster state (not even the master yet, as the execution is asynchronous)
2013-09-18 13:04:41 +02:00
Shay Banon db8f2be8bc improve logging on before/after shared cluster tests 2013-09-18 12:35:20 +02:00
Shay Banon 6a04c16932 Delete Template: When deleting with * and no templates exists, don't 404
closes #3723
2013-09-18 12:28:24 +02:00
Luca Cavanna 2d52973783 Added acknowledgment timeout test to OpenCloseIndexTests 2013-09-18 11:49:09 +02:00
Martijn van Groningen e84af5c8fd If there is an exception that indicates that the shard isn't available then the exception should bubble up to the TransportShardSingleOperationAction class, so the shard level request can be retried on a different shard. (multi get api) 2013-09-18 10:54:00 +02:00
Martijn van Groningen ae3f54bdb5 Don't wrap the exception in an ElasticSearchException when shard isn't available. 2013-09-18 10:53:34 +02:00
Martijn van Groningen f307336670 If there is an exception that indicates that the shard isn't available then the exception should bubble up to the TransportShardSingleOperationAction class, so the shard level request can be retried on a different shard. (multi term vector api) 2013-09-18 10:52:37 +02:00
Simon Willnauer 80b7377b29 Disable random ram directories to prevent OOM during tests.
We need to find a way to enable this without adding crazy heaps etc.
Maybe only selected tests can run this.
2013-09-18 08:28:41 +02:00
Simon Willnauer 81bd1f9fd2 Randomized SearchScanTests 2013-09-17 23:29:49 +02:00
Simon Willnauer 1499881c36 Simplify NestedFieldComparators for numerics
The average and sum comparators basically share the same code which is
copy-past today. We can simplify this into a base class which reduces
code duplication and prevents copy-paste bugs.
2013-09-17 23:07:36 +02:00
Simon Willnauer cabbf7805b Make TestCluster based integration tests more repoducible
While testing an async system providing reproducible tests that
use randomized components is a hard task we should at least try to
reestablish the enviroment of a failing test as much as possible.
This commit allows to re-establish the shared 'TestCluster' by
resetting the cluster to a predefined shared state before each test.

Before this commit a tests that is executed in isolation was likely
using a entirely different node enviroment as the failing test since
the 'TestCluster' kept intermediate nodes started by other tests around.
2013-09-17 23:07:29 +02:00
Clinton Gormley bf41f56f24 Added sort_mode and sortMode parameters to _geo_distance sort.
Previously it just support the "mode" parameter, which is
inconsistent

Closes #3717
2013-09-17 18:26:30 +02:00
Martijn van Groningen ca8b3ac0ba Don't throw set exception if it is an error based exception, this breaks how we deal with assertions in general. 2013-09-17 17:20:11 +02:00
Shay Banon ddc2b428d6 add 0.90.6 2013-09-17 15:04:48 +02:00
Simon Willnauer d45bf0b71e Print '-Des.x.y' properties in reproduce line 2013-09-17 14:28:51 +02:00
Costin Leau dcc45070bd Merge pull request #3702 from costin/master
add elasticsearch as a service for Windows platforms
2013-09-17 05:16:29 -07:00
Costin Leau 08bf131899 rework script to handle path with spaces
use service id for pid name
disable filtering on *.exe (caused corruption)
rename exe names and add more options to .bat
start/stop operations are now supported (and expected to be called) by service.bat
add more variables from the env to customize default behavior prior to installing the service
add manager option
fixes regarding batch flow
specify service id in description
minor readability improvement
include .exe only in ZIP archive
rename x64 service id to make it work out of the box
add elasticsearch as a service for Windows platforms
based on Apace Commons Daemon
supports both x64 and x86
2013-09-17 15:01:09 +03:00
Shay Banon cf30cb1caa Alias filter not applied when using 'multi-index' syntax with wild card in URL
closes #3677
2013-09-17 13:30:40 +02:00
Luca Cavanna 4013980b11 Serving cluster state version log line set to TRACE instead of DEBUG 2013-09-17 10:41:23 +02:00
Simon Willnauer dd8512ddd1 Autodetect indices when 'indexRandom' is used. 2013-09-17 09:22:25 +02:00
Simon Willnauer c18219e90d Create should use the same index name as the index request in tests 2013-09-17 09:02:49 +02:00
Shay Banon ae0489266e Add `node.mode` with `local` or `network`
Compared to setting node.local to true, would be nicer to support node.mode with values of local or network.

Note, node.local is still supported.

closes #3713
2013-09-17 00:34:10 +02:00
Simon Willnauer a6f14eb919 Beef up 'indexRandom' by running index requests concurrently 2013-09-17 00:06:13 +02:00
Shay Banon 8f7e3c8b53 Better handling of /_all/_search when no indices exist
closes #3710
2013-09-16 23:32:17 +02:00
Shay Banon c8a72d9768 FlushNotAllowedEngineException during optimize
default to wait if a flush is on going when executed as part of optimize request
closes #3631
2013-09-16 22:20:25 +02:00
Simon Willnauer da9aef60f4 Use 'indexRandom' in GeoDistanceTests 2013-09-16 21:57:44 +02:00
Luca Cavanna a1fb661df7 Fixed PluginManagerTests
It caused the deletion of the existing bin/plugin script when run from the IDE
2013-09-16 18:40:47 +02:00
Shay Banon e271177554 Plugins: Automatic detection of site plugins fails to copy over the content to `_site`
closes #3707
2013-09-16 18:12:51 +02:00
Shay Banon fd4ab5c3dc add 0.90.5 2013-09-16 18:12:51 +02:00
Simon Willnauer 5396d8e149 Copy slow in wrapped comparator even if root doc is the first doc in the
segment.

We missed to copy the slot if the root doc is the first doc in the
segment.

Closes #3706
2013-09-16 17:12:06 +02:00
Luca Cavanna a9e0f4d29d RecoveryWhileUnderLoadTests: added output of all shards stats in case of failure
Added wait to see if the problem will eventually get fixed or not in case of failure
2013-09-16 16:22:24 +02:00
Luca Cavanna c8bcdd0780 Replaced count api with search (search_type=count) in RecoveryWhileUnderLoadTests checks
This way we get the logging of all the shards we searched on
2013-09-16 16:22:24 +02:00
Britta Weber 86f147fc0b remove default scale for geo fields 2013-09-16 15:16:40 +02:00
Britta Weber 4938f09d8d allow origin not set, defaults to "now" for date fields, exception for all other types 2013-09-16 15:16:40 +02:00
Britta Weber f12fa0c1c4 allow no query is defined in function score, default is match all 2013-09-16 15:16:40 +02:00
Simon Willnauer 6c3e7d36c0 If cluster health times out don't index lots of documents
The SearchWithRandomExceptionTests aim to catch problems when resources
are not closed due to exceptions etc. Yet in some cases the random seeds
cause the index to never be fully allocated so we basically go into a
ping-pong state where we try to allocate shards back and forth on nodes.
This causes all docs to time out which in-turn causes the tests to run
for a very long time (hours or days).
If we can not allocate the index and get to a yellow state we simply
index only one doc and expected all searches to fail.

This commit also beefs up the assertions in this test to check if
documents are actually present if they are indexed and refresh was
successful.

Closes #3694
2013-09-16 14:12:41 +02:00
Simon Willnauer 85fcefc60d Allow include / exclude of completion stats via REST parameters
Stats can be retrieved on a per-feature / per-component  basis including the fields
they apply to. This commit add support for a 'completion' flag to include statistics
for the complition feature as well as 'completion_fields' to only
include certain fields into the returned statistics.
To disambiguate between 'fielddata' and 'completion' fields this commit
uses 'fields' as the default inclusion filter for stats fields only used
if not dedicated '[completion|fielddata]_fields' paramter is provided.

Relates to #3522
2013-09-16 11:28:32 +02:00
matthewarkin 6356ad2228 Debian init script: Added armhf openjdk6/7
Added java-6-openjdk-armhf and java-7-openjdk-armhf to JDK_DIRS in debian init.d script per elasticsearch/elasticsearch#3659

Closes #3659
2013-09-16 09:56:21 +02:00
Alexander Reelsen e0af9e2c09 Making debian init script bourne shell compatible
Using backticks instead of bash only $() to execute a shell command

Closes #3691
2013-09-16 09:46:43 +02:00
Britta Weber bc65e5c5b6 don't serialize unneeded filter 2013-09-16 09:40:23 +02:00
Shay Banon cd90382964 upgrade to google guava v 15 2013-09-16 09:14:00 +02:00
Britta Weber 3162eb4dcf defining filter is not always needed, we can assume match all if no filter is given 2013-09-16 00:30:03 +02:00
Shay Banon 20745adadd Add dedicated Suggest Thread Pool
Add a dedicated suggest thread pool for the suggest API. With the new completion suggest type, which is purely CPU bounded, it makes more sense to have a dedicated thread pool for suggest compared to having it share the search thread pool and "competing" against other search operations.
closes #3698
2013-09-15 01:54:27 +02:00
Shay Banon 4a97af3cd4 use static TL for common numeric precision values 2013-09-15 01:40:35 +02:00
Shay Banon 89e0b325c2 Briefly delete manifested mapping type on a node without reason
When a dynamic type is introduced during indexing, the node that introduces it sends the fact that its added to the master, to be added to the master node. The master node then adds it to the index metadata and republishes that fact.

In order not to delete the mapping while the new type is introduced on the node that introduced it, we keep a map of seen mappings, and remove a mapping type when we already processed it.

The map is not properly cleared though in all places where an actual index service is being removed on a node.

closes #3697
2013-09-14 22:42:53 +02:00
Britta Weber e58900145b tag with @AwaitsFix because it causes the test suite to crash
see #3694
Also, this might have caused one of the problems described in issue #3674
2013-09-14 11:51:34 +02:00
Shay Banon d6a3fc09f0 better logging
trace log the low level details on recovery
2013-09-13 22:46:04 +02:00
Shay Banon 056a678fa8 use built in flush/refresh helper methods 2013-09-13 22:06:12 +02:00
Shay Banon df3f681ef0 Optimize API: Remove refresh flag
Refresh flag in optimize is problematic, since the shards refresh is allowed to execute on is different compared to the optimize shards. In order to do optimize and then refresh, they should be executed as separate APIs when needed.
closes #3690
2013-09-13 21:44:38 +02:00
Shay Banon 7cc48c8e87 Flush API: remove refresh flag
Refresh flag in flush is problematic, since the shards refresh is allowed to execute on is different compared to the flush shards. In order to do flush and then refresh, they should be executed as separate APIs when needed.
closes #3689
2013-09-13 21:09:45 +02:00
Shay Banon 4298c50119 allow refresh to execute on a relocating shard as well 2013-09-13 20:03:58 +02:00
Simon Willnauer d9a055fe54 Add integration test for regex field data filter 2013-09-13 19:55:50 +02:00
Adrien Grand f03816ff07 Log failures at closing the SearcherManager. 2013-09-13 18:03:28 +02:00
Alexander Reelsen 26f9968b3b Allow packages to disable immediate restart on package upgrade
Both package types, RPM and deb now contain an option to not restart on upgrade.

This option can be configure in /etc/default/elasticsearch for dpkg based systems
and /etc/sysconfig/elasticsearch for rpm based systems.

By default the setting is as before, where a restart is executed on upgrade.

Closes #3685
2013-09-13 17:45:39 +02:00
Shay Banon ba6bc2a4df improve logging
the source of the default mappings should be trace logged
2013-09-13 17:38:57 +02:00
Shay Banon 455d0be982 improve visibility of clusterState and shardsIt
In case of retries, we update the clusterState and shardsIt, make sure they are visible using volatile (even though updates will probably go through a memory barrier, this might explain rare failure we see when retry happens)
2013-09-13 17:35:01 +02:00
Luca Cavanna f7ff272560 Improved test
Introduced ElasticsearchAssertions that check for failures in all response
Added comment to flush requests as we don't check for failures there
Attempt to remove Thread.sleep in testChangeInitialShardsRecovery in favour of awaitBusy block
Added awaitBusy block in testQuorumRecovery waiting for YELLOW. We could have GREEN after the close node but wa want to wait for the YELLOW state.
2013-09-13 16:39:08 +02:00
Luca Cavanna bb0baa20fb Removed wrong assertion that makes recoverWhileUnderLoadWithNodeShutdown fail.
As we are within an awaitBusy block, it doesn't make sense to have an assertion, since it would fail the test instead of waiting till the condition is verified (till timeout expires)
2013-09-13 16:39:08 +02:00
Shay Banon ea00e39ff1 use trace logging on cluster state driven indexing 2013-09-13 16:35:11 +02:00
David Pilato a2444e9494 Remove get index templates deprecated methods
In 0.90.4, we deprecated some code:

* `GetIndexTemplatesRequest#GetIndexTemplatesRequest(String)` moved to `GetIndexTemplatesRequest#GetIndexTemplatesRequest(String...)`
* `GetIndexTemplatesRequest#name(String)` moved to `GetIndexTemplatesRequest#names(String...)`
* `GetIndexTemplatesRequest#name()` moved to `GetIndexTemplatesRequest#names()`

* `GetIndexTemplatesRequestBuilder#GetIndexTemplatesRequestBuilder(IndicesAdminClient, String)` moved to  `GetIndexTemplatesRequestBuilder#GetIndexTemplatesRequestBuilder(IndicesAdminClient, String...)`

* `IndicesAdminClient#prepareGetTemplates(String)` moved to `IndicesAdminClient#prepareGetTemplates(String...)`

* `AbstractIndicesAdminClient#prepareGetTemplates(String)` moved to `AbstractIndicesAdminClient#prepareGetTemplates(String...)`

We can now remove that old methods in 1.0.

**Note**: it breaks the Java API

Relative to #2532.
Closes #3681.
2013-09-13 15:08:59 +02:00
David Pilato ea4988e9dc Support for REST get ALL templates.
/_template shows: No handler found for uri [/_template] and method [GET]

It would make sense to list the templates as they are listed in the /_cluster/state call.

Closes #2532.
2013-09-13 15:08:59 +02:00
Britta Weber e3b826f87e add wait for green to prevent test failure 2013-09-13 14:50:51 +02:00
Shay Banon d66d326ba9 mark test base classes as abstract 2013-09-13 12:14:52 +02:00
David Pilato e2400bc40e Fix possible NPE due to #3658 change 2013-09-13 11:49:16 +02:00
David Pilato b27e7d3cc9 Remove RestActions#splitXXX(String) methods
* `RestActions#splitIndices(String)`
* `RestActions#splitTypes(String)`
* `RestActions#splitNodes(String)`

And replace with `Strings.splitStringByCommaToArray(String)`

Closes #3680.
2013-09-13 11:36:43 +02:00
Igor Motov 714aaa40ea CompletionFieldMapper should use index name instead of full name
Fixes #3669
2013-09-12 17:39:03 -04:00
Simon Willnauer 507b6a6e8c Fix several places where resources are not closed
This commit adds a test that checks that we are closing
all files even if there are random IOExceptions happening. The test
found several places where due to IOExceptions streams were not
closed due to unsufficient exception handling.
2013-09-12 23:24:27 +02:00
Luca Cavanna 439413c626 Introduced common test methods in MatchedQueriesTests (e.g. createIndex, ensureGreen, refresh, assertHitCount) 2013-09-12 21:03:33 +02:00
Luca Cavanna 3a5b325b23 Added specific log level to check which shards were refreshed and which shards we searched on 2013-09-12 19:53:59 +02:00
Martijn van Groningen 8ddb809f98 If all scroll ids should be removed then the `_all` value should be used instead of not specifying any scroll ids. 2013-09-12 10:41:38 +02:00
Martijn van Groningen 1fe72dcf56 Moved to use assertHitCount instead of just checking the total count 2013-09-12 10:25:42 +02:00
Martijn van Groningen d3aacba6c6 Set log level to trace for package action.support.broadcast in the RecoveryPercolatorTests#testSinglePercolator_recovery test. 2013-09-12 10:19:10 +02:00
Simon Willnauer fddb7420ae Add support for Lucene's MockDirectoryWrapper
MockDirectoryWrapper adds asserting logic to the low level directory
implementation that helps to track and catch resource leaks like
unclosed index inputs caused by dangling IndexReader or IndexSearcher
instances. It prevents double writes to files and allows low level
random exceptions to be thrown for testing index consistency etc.

Closes #3654
2013-09-11 22:47:34 +02:00
Simon Willnauer c2675bac50 Added 'IntegrationTests' annotation to filter integration tests
Tests now support ignoring integartion tests by passing
'-Dtests.integration=false' to the test runner either via IDE or
maven to only run fast unittests.
2013-09-11 22:12:38 +02:00
Luca Cavanna ff54cba807 fixed typo in javadoc 2013-09-11 21:00:53 +02:00
Andrew Raines 6c9542d967 Fix misspellings. 2013-09-11 13:49:33 -05:00
Andrew Raines 7425b85b0b Collapse test.{unit,integration} into org.elasticsearch. 2013-09-11 12:49:49 -05:00
Shay Banon bbce6e8588 Rare race condition when introducing new fields into a mapping
Dynamic mapping allow to dynamically introduce new fields into an existing mapping. There is a (pretty rare) race condition, where a new field/object being introduced will not be immediately visible for another document that introduces it at the same time.

closes #3667, closes #3544
2013-09-11 07:08:57 -07:00
Luca Cavanna 012797a82c Loggers#getLogger static method to take into account the logger prefix
Improved LoggingListener (which reads and applies @TestLogging annotation) to take into account the logger prefix. We can now use the @TestLogging annotation and specify either the whole package name (e.g. o.e.action.metadata) or only the package name without the logger prefix (action.metadata), the custom log level will be properly applied in both cases
2013-09-11 16:04:08 +02:00
Luca Cavanna daedf853a0 Removed logger prefixes when using @TestLogging annotation 2013-09-11 11:24:07 +02:00
Martijn van Groningen 1d8457394d Added more trace logging.
Enabled trace logging for RecoveryPercolatorTests#testMultiPercolator_recovery test
Cleaned up and removed unnecessary usage of concurrent collections.
2013-09-11 11:20:08 +02:00
Luca Cavanna 0b79ba9493 Rewrote SuggestResponse#toString method
It only prints out json now (as the SearchResponse does)
Added missing startObject & endObject (was causing JsonGenerationException)

Closes #3661
2013-09-10 22:33:51 +02:00
Martijn van Groningen 0efa78710b Added clear scroll api.
The clear scroll api allows clear all resources associated with a `scroll_id` by deleting the `scroll_id` and its associated SearchContext.

Closes #3657
2013-09-10 21:17:34 +02:00
David Pilato fafc4eef98 Plugin Manager: add silent mode.
Now with have proper exit codes for elasticsearch plugin manager (see #3463), we can add a silent mode to plugin manager.

```sh
bin/plugin --install karmi/elasticsearch-paramedic --silent
```

Closes #3628.
2013-09-10 18:31:35 +02:00
Britta Weber a91653cf1a change logging level of testTimeoutSendExceptionWithDelayedResponse to TRACE 2013-09-10 17:19:26 +02:00
Luca Cavanna 4032f1eb44 Configured TRACE logging to RecoveryWhileUnderLoadTests#recoverWhileUnderLoadAllocateBackupsTest
We want to log which shards we are searching on and which shards we are refreshing
2013-09-10 14:28:59 +02:00
Britta Weber 7c20603071 use ElasticsearchAssertions to get info on shard failures 2013-09-10 12:13:37 +02:00
Simon Willnauer 5c00dc5773 Rename IndexShard#searcher() to #acquireSearcher()
Based on recent bugs ( #3652 ) where searchers were acquired multiple times
but never released 'IndexShard#searcher()' has not a more accurate name.

Closes #3653
2013-09-09 21:21:27 +02:00
Simon Willnauer 777d7f47a5 Catch ESRejectedExecutionException on node close
When a node shuts down thread pools might throw
ESRejectedExecutionException and our test framework fails tests if
exceptions are not caught hitting uncaught exception handler.
2013-09-09 21:21:27 +02:00
David Pilato 764aa54f2d Plugin Manager should support -remove group/artifact/version naming
When installing a plugin, we use:

```sh
bin/plugin --install groupid/artifactid/version
```

But when removing the plugin, we only support:

```sh
bin/plugin --remove dirname
```

where `dirname` is the directory name of the plugin under `/plugins` dir.

Closes #3421.
2013-09-09 21:17:16 +02:00
Simon Willnauer 76cc8c3549 Only pull searcher once during completion stats
The inner call to the completion stats pulled a second searcher
that never got released causing the underlying readers to never
get closed unless the node is shut down. This was triggered
with literally each stats call including the completion stats
even if no completion service was used on the index.

Closes #3652
2013-09-09 17:50:41 +02:00
Lee Hinman 7d52d58747 Add AllocationDecider that takes free disk space into account
This commit adds two main pieces, the first is a ClusterInfoService
that provides a service running on the master nodes that fetches the
total/free bytes for each data node in the cluster as well as the
sizes of all shards in the cluster. This information is gathered by
default every 30 seconds, and can be changed dynamically by setting
the `cluster.info.update.interval` setting. This ClusterInfoService
can hopefully be used in the future to weight nodes for allocation
based on their disk usage, if desired.

The second main piece is the DiskThresholdDecider, which can disallow
a shard from being allocated to a node, or from remaining on the node
depending on configuration parameters. There are three main
configuration parameters for the DiskThresholdDecider:

`cluster.routing.allocation.disk.threshold_enabled` controls whether
the decider is enabled. It defaults to false (disabled). Note that the
decider is also disabled for clusters with only a single data node.

`cluster.routing.allocation.disk.watermark.low` controls the low
watermark for disk usage. It defaults to 0.70, meaning ES will not
allocate new shards to nodes once they have more than 70% disk
used. It can also be set to an absolute byte value (like 500mb) to
prevent ES from allocating shards if less than the configured amount
of space is available.

`cluster.routing.allocation.disk.watermark.high` controls the high
watermark. It defaults to 0.85, meaning ES will attempt to relocate
shards to another node if the node disk usage rises above 85%. It can
also be set to an absolute byte value (similar to the low watermark)
to relocate shards once less than the configured amount of space is
available on the node.

Closes #3480
2013-09-09 09:49:30 -06:00
Luca Cavanna 563111f0f9 Fixed typo: renamed test wamer package to warmer 2013-09-09 14:24:21 +02:00
Luca Cavanna 8ad583b35e Fixed typo: renamed test.listerners package to test.listener 2013-09-09 14:24:21 +02:00
Luca Cavanna 5fdae8ba10 Restored log lines to TRACE for notification post alias creation and open/close index
Introduced specific log level for those in OpenCloseIndexTests#testCloseOpenAliasMultipleIndices
2013-09-09 14:24:21 +02:00
Luca Cavanna 9e72683ba4 Added @TestLogging annotation to set a specific level per test method
It supports multiple logger:level comma separated key value pairs
 Use the _root keyword to set the root logger level
 e.g. @Logging("_root:DEBUG,org.elasticsearch.cluster.metadata:TRACE")
 or just @TestLogging("_root:DEBUG,cluster.metadata:TRACE") since we start the test with -Des.logger.prefix=
2013-09-09 14:24:21 +02:00
Simon Willnauer 453e7c1510 Use same index name for indexing that is used for creating the index 2013-09-09 13:01:53 +02:00
Simon Willnauer 732e38b8c7 Throw IAE if reserved completion suggester chars are used in input
The completion suggester reserves 0x00 and 0xFF as for internal use.
If those chars are used in the input string an IAE is thrown and the
input is rejected.

Closes #3648
2013-09-09 11:57:01 +02:00
Simon Willnauer d7b3ed7e8b Only use one document to test empty shards 2013-09-09 10:53:53 +02:00
Simon Willnauer a5bf8824d2 Remove createMapped and mapping helpers from AbstractSharedClusterTest
our tests should use the API we have in favor of hard to read / understand
test helpers.
2013-09-09 09:29:22 +02:00
Nik Everett da4c58d853 Beautify SuggestSearchTests.
SuggestSearchTests had tons of duplicate code and didn't use all of the
fancy new integration test helper method.  I've removed a ton of duplicate
code and used as many of the nice test helper method I could think of.

Closes #3611
2013-09-09 09:16:47 +02:00
Shay Banon 3c5dd43928 fix logging level 2013-09-08 00:32:44 +02:00
Martijn van Groningen 86d69bb41c field rename 2013-09-06 21:35:53 +02:00
Martijn van Groningen b01dececac Removed matched_filters in favor for matched_queries.
Closes #3644
2013-09-06 21:34:08 +02:00
Martijn van Groningen 29ea6b3071 Deprecate the method names `namedFilter` in favor of `namedQueries`.
The reason behind this is that the `_name` support has been extended to queries as well and the name `namedQueries` suggests better that it is applicable to the whole query dsl.

Relates to #3581
2013-09-06 21:15:22 +02:00
Shay Banon 2767c081cd Allow to control the number of processors sizes are based on
Sometimes, one wants to just control the number of processors our different size base calculations for thread pools and network workers are based on, and not use the reported available processor by the OS. Add processors setting, where it can be controlled.

closes #3643
2013-09-06 19:04:15 +02:00
Adrien Grand c9a7bb26ba Remember to think about filter caching when upgrading to Lucene 4.5. 2013-09-06 18:23:16 +02:00
Simon Willnauer 8203d4dbcf fix potential blocking of NettyTransport connect and disconnect methods
Currently, in NettyTransport the locks for connecting and disconnecting channels are stored in a ConcurrentMap that has 500 entries. A tread can acquire a lock for an id and the lock returned is chosen on a hash function computed from the id.
Unfortunately, a collision of two ids can cause a deadlock as follows:

Scenario: one master (no data), one datanode (only data node)

DiscoveryNode id of master is X
DiscoveryNode id of datanode is Y

Both X and Y cause the same lock to be returned by NettyTransport#connectLock()

Both are up and running, all is fine until master stops.

Thread 1: The master fault detection of the datanode is notified (onNodeDisconnected()), which in turn leads the node to try and reconnect to master via the callstack titled "Thread 1" below.

-> connectToNode() is called and lock for X is acquired. The method waits for 45s for the cannels to reconnect.

Furthermore, Thread 1 holds the NettyTransport#masterNodeMutex.

Thread 2: The connection fails with an exception (connection refused, see callstack below), because the master shut down already. The exception is handled in NettyTransport#exceptionCaught which calls NettyTransport#disconnectFromNodeChannel. This method acquires the lock for Y (see Thread 2 below).

Now, if Y and X have two different locks, this would get the lock, disconnect the channels and notify thread 1. But since X and Y have the same locks, thread 2 is deadlocked with thread 1 which waits for 45s.

In this time, no thread can acquire the masterNodeMutex (held by thread 1), so the node can, for example, not stop.

This commit introduces a mechanism that assures unique locks for unique ids. This lock is not reentrant and therfore assures that threads can not end up in an infinite recursion (see Thread 3 below for an example on how a thread can aquire a lock twice).
While this is not a problem right now, it is potentially dangerous to have it that way, because the callstacks are complex as is and slight changes might cause unecpected recursions.

Thread 1
----

	owns: Object  (id=114)
	owns: Object  (id=118)
	waiting for: DefaultChannelFuture  (id=140)
	Object.wait(long) line: not available [native method]
	DefaultChannelFuture(Object).wait(long, int) line: 461
	DefaultChannelFuture.await0(long, boolean) line: 311
	DefaultChannelFuture.awaitUninterruptibly(long) line: 285
	NettyTransport.connectToChannels(NettyTransport$NodeChannels, DiscoveryNode) line: 672
	NettyTransport.connectToNode(DiscoveryNode, boolean) line: 609
	NettyTransport.connectToNode(DiscoveryNode) line: 579
	TransportService.connectToNode(DiscoveryNode) line: 129
	MasterFaultDetection.handleTransportDisconnect(DiscoveryNode) line: 195
	MasterFaultDetection.access$0(MasterFaultDetection, DiscoveryNode) line: 188
	MasterFaultDetection$FDConnectionListener.onNodeDisconnected(DiscoveryNode) line: 245
	TransportService$Adapter$2.run() line: 298
	EsThreadPoolExecutor(ThreadPoolExecutor).runWorker(ThreadPoolExecutor$Worker) line: 1145
	ThreadPoolExecutor$Worker.run() line: 615
	Thread.run() line: 724

Thread 2
-------

	waiting for: Object  (id=114)
	NettyTransport.disconnectFromNodeChannel(Channel, Throwable) line: 790
	NettyTransport.exceptionCaught(ChannelHandlerContext, ExceptionEvent) line: 495
	MessageChannelHandler.exceptionCaught(ChannelHandlerContext, ExceptionEvent) line: 228
	MessageChannelHandler(SimpleChannelUpstreamHandler).handleUpstream(ChannelHandlerContext, ChannelEvent) line: 112
	DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline$DefaultChannelHandlerContext, ChannelEvent) line: 564
	DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(ChannelEvent) line: 791
	SizeHeaderFrameDecoder(FrameDecoder).exceptionCaught(ChannelHandlerContext, ExceptionEvent) line: 377
	SizeHeaderFrameDecoder(SimpleChannelUpstreamHandler).handleUpstream(ChannelHandlerContext, ChannelEvent) line: 112
	DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline$DefaultChannelHandlerContext, ChannelEvent) line: 564
	DefaultChannelPipeline.sendUpstream(ChannelEvent) line: 559
	Channels.fireExceptionCaught(Channel, Throwable) line: 525
	NioClientBoss.processSelectedKeys(Set<SelectionKey>) line: 110
	NioClientBoss.process(Selector) line: 79
	NioClientBoss(AbstractNioSelector).run() line: 312
	NioClientBoss.run() line: 42
	ThreadRenamingRunnable.run() line: 108
	DeadLockProofWorker$1.run() line: 42
	ThreadPoolExecutor.runWorker(ThreadPoolExecutor$Worker) line: 1145
	ThreadPoolExecutor$Worker.run() line: 615
	Thread.run() line: 724

Thread 3
---------

        org.elasticsearch.transport.netty.NettyTransport.disconnectFromNode(NettyTransport.java:772)
        org.elasticsearch.transport.netty.NettyTransport.access$1200(NettyTransport.java:92)
        org.elasticsearch.transport.netty.NettyTransport$ChannelCloseListener.operationComplete(NettyTransport.java:830)
        org.jboss.netty.channel.DefaultChannelFuture.notifyListener(DefaultChannelFuture.java:427)
        org.jboss.netty.channel.DefaultChannelFuture.notifyListeners(DefaultChannelFuture.java:418)
        org.jboss.netty.channel.DefaultChannelFuture.setSuccess(DefaultChannelFuture.java:362)
        org.jboss.netty.channel.AbstractChannel$ChannelCloseFuture.setClosed(AbstractChannel.java:355)
        org.jboss.netty.channel.AbstractChannel.setClosed(AbstractChannel.java:185)
        org.jboss.netty.channel.socket.nio.AbstractNioChannel.setClosed(AbstractNioChannel.java:197)
        org.jboss.netty.channel.socket.nio.NioSocketChannel.setClosed(NioSocketChannel.java:84)
        org.jboss.netty.channel.socket.nio.AbstractNioWorker.close(AbstractNioWorker.java:357)
        org.jboss.netty.channel.socket.nio.NioClientSocketPipelineSink.eventSunk(NioClientSocketPipelineSink.java:58)
        org.jboss.netty.channel.Channels.close(Channels.java:812)
        org.jboss.netty.channel.AbstractChannel.close(AbstractChannel.java:197)
        org.elasticsearch.transport.netty.NettyTransport$NodeChannels.closeChannelsAndWait(NettyTransport.java:892)
        org.elasticsearch.transport.netty.NettyTransport$NodeChannels.close(NettyTransport.java:879)
        org.elasticsearch.transport.netty.NettyTransport.disconnectFromNode(NettyTransport.java:778)
        org.elasticsearch.transport.netty.NettyTransport.access$1200(NettyTransport.java:92)
        org.elasticsearch.transport.netty.NettyTransport$ChannelCloseListener.operationComplete(NettyTransport.java:830)
        org.jboss.netty.channel.DefaultChannelFuture.notifyListener(DefaultChannelFuture.java:427)
        org.jboss.netty.channel.DefaultChannelFuture.notifyListeners(DefaultChannelFuture.java:418)
        org.jboss.netty.channel.DefaultChannelFuture.setSuccess(DefaultChannelFuture.java:362)
        org.jboss.netty.channel.AbstractChannel$ChannelCloseFuture.setClosed(AbstractChannel.java:355)
        org.jboss.netty.channel.AbstractChannel.setClosed(AbstractChannel.java:185)
        org.jboss.netty.channel.socket.nio.AbstractNioChannel.setClosed(AbstractNioChannel.java:197)
        org.jboss.netty.channel.socket.nio.NioSocketChannel.setClosed(NioSocketChannel.java:84)
        org.jboss.netty.channel.socket.nio.AbstractNioWorker.close(AbstractNioWorker.java:357)
        org.jboss.netty.channel.socket.nio.NioWorker.read(NioWorker.java:93)
        org.jboss.netty.channel.socket.nio.AbstractNioWorker.process(AbstractNioWorker.java:109)
        org.jboss.netty.channel.socket.nio.AbstractNioSelector.run(AbstractNioSelector.java:312)
        org.jboss.netty.channel.socket.nio.AbstractNioWorker.run(AbstractNioWorker.java:90)
        org.jboss.netty.channel.socket.nio.NioWorker.run(NioWorker.java:178)
        java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
        java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
        java.lang.Thread.run(Thread.java:724)
2013-09-06 17:56:18 +02:00
Shay Banon 4155741f7f BytesStreamOutput default size should be 2k instead of 32k
We changed the default of BytesStreamOutput (used in various places in ES) to 32k from 1k with the assumption that most stream tend to be large. This doesn't hold for example when indexing small documents and adding them using XContentBuilder (which will have a large overhead).

Default the buffer size to 2k now, but be relatively aggressive in expanding the buffer when below 256k (double it), and just use oversize (1/8th) when larger to try and minimize garbage and buffer copies.

relates to #3624
closes #3638
2013-09-06 02:25:17 +02:00
Shay Banon 3e92b1d6b8 Not allowing index names in request body for multi-get/search/bulk when indices are already given in url
closes #3636
2013-09-06 01:46:24 +02:00
Shay Banon 95b894e6f6 On Solaris, default LZF compress type (for transport) can cause segfault
closes #3634
2013-09-06 00:41:14 +02:00
Shay Banon b3d51df493 change to trace level logging 2013-09-05 20:30:22 +02:00
Shay Banon cebd3ca9c3 improve setting response/failure on nodes actions
we can use the index in the node ids list as the index for the array when we set the response or the exception, removing the need for an index AtomicInteger
2013-09-05 17:59:52 +02:00
Simon Willnauer f968ca317a Use lucene test framework if low level lucene parts are involved in tests.
Test should never write outside of the test directories.
2013-09-05 17:21:59 +02:00
Simon Willnauer 1b756ba23a Revert "Add FastVectorHighlighter support for more complex queries."
This reverts commit e943cc81a5.

The more complex queries support causes StackOverflowErrors that
can influence the cluster performance and stability dramatically.
This commit backs out this change to reduce the risk for deep
stacks.

Reverts #3357
2013-09-05 17:19:28 +02:00
Shay Banon 623e340d4f ignore rejected exception when shutting down in cluster service 2013-09-05 16:52:57 +02:00
Luca Cavanna 81d70b1ef8 Added tests for count api
testDateRangeInQueryString awaits fix (#3625)
2013-09-05 16:01:09 +02:00
Boaz Leskes c6ac5ac433 Make the acceptable compression overhead used by MultiOrdinals configurable and default to PackedInts.FASTEST (causing it to byte align).
Closes #3623

Before this commit , this was the output of TermsFacetSearchBenchmark, on my MacBookAir:

```
------------------ SUMMARY -------------------------------
                     name      took    millis
                  terms_s      7.3s        36
              terms_map_s     28.8s       144
                  terms_l     15.9s        79
              terms_map_l     15.5s        77
                 terms_sm        1m       319
             terms_map_sm      4.9m      1491
                 terms_lm      2.7m       825
             terms_map_lm      2.7m       829
          terms_stats_s_l     37.6s       188
         terms_stats_s_lm      2.4m       722
         terms_stats_sm_l      6.5m      1958
------------------ SUMMARY -------------------------------
```

After the change to FASTEST, we have:

```
------------------ SUMMARY -------------------------------
                     name      took    millis
                  terms_s      6.9s        34
              terms_map_s     28.8s       144
                  terms_l     17.4s        87
              terms_map_l     17.6s        88
                 terms_sm       42s       210
             terms_map_sm      4.2m      1287
                 terms_lm      2.3m       714
             terms_map_lm      2.3m       716
          terms_stats_s_l     37.5s       187
         terms_stats_s_lm      1.6m       482
         terms_stats_sm_l      6.1m      1852
------------------ SUMMARY -------------------------------
```
2013-09-05 15:05:37 +02:00
Boaz Leskes e33107d493 TransportSearchTypeAction logs used shards under TRACE level 2013-09-05 13:34:12 +02:00
Boaz Leskes 1de7b1a70c Minor cleanup to logging messages. 2013-09-05 12:42:38 +02:00
Simon Willnauer 764a519627 Return empty completion stats if engine throws an exception
If the index shard is not started yet the underlying engine can
throw an exception since not everything is initialized. This can
happen if a shard is just about starting up or recovering / initalizing
and stats are requested.

Closes #3619
2013-09-05 10:10:40 +02:00
Boaz Leskes f93efc3605 Added cluster state version to the debug logging of shards instances used in search. 2013-09-04 11:08:00 +02:00
Luca Cavanna e5b829303e Added client_ prefix to node clients created by TestCluster (client_node_#) 2013-09-04 10:37:00 +02:00
Luca Cavanna 74b00b63ea Node clients in tests use now the same naming convention as ordinary nodes (node#) 2013-09-04 10:26:18 +02:00
Simon Willnauer d5323231fe Clean up warnings in commons package. 2013-09-03 21:52:50 +02:00
Simon Willnauer 2ac7421f89 Remove UUID class in favor of Strings util methods 2013-09-03 21:52:50 +02:00
Martijn van Groningen d5a47e597d Removed ThreadLocals class and its references, since it is no longer needed. 2013-09-03 17:57:11 +02:00
Simon Willnauer b39961b2a6 Prevent ShardAllocator to modify the unassigned while running allocations
The unassinged list is used to make allocation decisions but is currently
modified during allocation runs which causes primaries to be throttled
during allocation. If this happens newly allocated indices can be stalled
for a long time turning a cluster into a RED state if concurrent relocations
and / or recoveries are happening.

Closes #3610
2013-09-03 17:09:44 +02:00
Luca Cavanna ca6c26c62d Improved test
Removed needless delete lines, added log lines and shared ensureGreen calls
2013-09-03 16:46:05 +02:00
Luca Cavanna 2f10f94c13 Fixed PluginManagerTests to connect to the right node when checking if the plugin is available 2013-09-03 15:47:57 +02:00
Luca Cavanna 73a7b06d21 Switched PluginManagerTests to use default plugins location and added check that http connector is working properly 2013-09-03 15:08:43 +02:00
Luca Cavanna f9f664bc3b Added errorStream null check in HttpClient (used for testing purpose) 2013-09-03 14:18:04 +02:00
Shay Banon 058f57b198 test for primary allocating over replicas
still marked as await fix, requires investigation
2013-09-03 11:58:14 +02:00
Luca Cavanna 2d1b841ba1 Replaced localhost with 127.0.0.1 in PluginManagerTests 2013-09-03 11:44:56 +02:00
Luca Cavanna 45c8da3e98 Improved logic that removes top-level folder from archives when needed
Whether we remove the top-level folder from the archive depends now on the zip itself and not on where it was downloaded from. That makes it work installing local files too.

Closes #3582
2013-09-03 10:34:32 +02:00
Simon Willnauer eb2fed85f1 Add 'min_input_len' to completion suggester
Restrict the size of the input length to a reasonable size otherwise very
long strings can cause StackOverflowExceptions deep down in lucene land.
Yet, this is simply a saftly limit set to `50` UTF-16 codepoints by default.
This limit is only present at index time and not at query time. If prefix
completions > 50 UTF-16 codepoints are expected / desired this limit should be raised.
Critical string sizes are beyone the 1k UTF-16 Codepoints limit.

Closes #3596
2013-09-03 10:26:37 +02:00
Martijn van Groningen eed7f0bdb3 Restructured the transport action code for multi percolate api. 2013-09-03 10:19:58 +02:00
Boaz Leskes 7307e37efe Previously added logging in TransportRefreshAction caused NPE if search shards had errors (or was not yet started/assigned)
Better formatting for logging in TransportRefreshAction
2013-09-02 21:53:00 +02:00
Boaz Leskes a48c437ffb Search action now log in debug what shards/nodes were used before moving to second phase
Added  a debug log for executing a refresh request on a shard.
2013-09-02 17:17:53 +02:00
Luca Cavanna 91c3853452 Added new iteration to RecoveryWhileUnderLoadTests
We want to check whether the issue causing the test to fail would be fixed by an additional refresh or not
2013-09-02 16:29:49 +02:00
Luca Cavanna fc1d6670df Added log lines to log (debug level) acknowledgements regarding index alias creation and index state change 2013-09-02 12:16:14 +02:00
Luca Cavanna 38be478c46 Fixed close index when the index is already closed
Closes #3601
2013-09-02 10:58:09 +02:00
Luca Cavanna 206ab3a6d4 Used ElasticsearchAssertions to check count result in RecoveryWhileUnderLoadTests 2013-09-02 10:30:10 +02:00
Simon Willnauer 69848210d6 Allow up to 10% unbalance in random allocator tests 2013-08-31 09:13:54 +02:00
Boaz Leskes be09103258 SearchWhileCreatingIndexTests didn't always supply enough node for write consistency requirements and thus hanged.
Added more debug logging to TransportShardReplicationOperationAction

*Changed* node naming in tests from GUIDs to node# based naming as they are much easier to read
2013-08-30 20:56:23 +02:00
Martijn van Groningen be00437c65 Changed expectedOperationsPerItem from AtomicInteger array to AtomicReferenceArray<AtomicInteger>.
Made node stopping / starting less aggressive in RecoveryPercolatorTests.
2013-08-30 16:10:53 +02:00
Simon Willnauer c9c850167f Add more trace logging if shard allocation is throttled 2013-08-30 14:05:53 +02:00
Boaz Leskes c70b8fbd7b Added total, successful shard info to search related asserts in ElasticsearchAssertions
Rewrote SimpleSearchTests assertion to use that.
2013-08-30 14:02:13 +02:00
Simon Willnauer f8cf5ae7e9 Added Random test for ShardAllocator.
This test will make random allocation decision on a growing and
shrinking cluster leading to a random distribution of the shards.
After a certain amount of iterations the test allows allocation unless
the same shard is already allocated on a node and balances the cluster
to gain optimal balance.
2013-08-30 10:11:45 +02:00
Martijn van Groningen a7b2b7847a Use atomic collections to make sure all of the memory contents are visible from writing to reading thread. 2013-08-30 00:06:45 +02:00
Simon Willnauer 7113731022 Execute listeners on current thread if threadpool is shutting down 2013-08-29 16:40:38 +02:00
Simon Willnauer f408673bd4 Force default codec in tests where we rely on the latest lucene defaults 2013-08-29 16:40:38 +02:00
Nik Everett 10e55bd3ef Recheck cutoffScore during phrase_suggest merge.
The goal is to throw out suggestions that only meet the cutoff in some
shards.  This will happen if your input phrase is only contained in a
few shards.  If your shards are unbanced this rechecking can throw out
good suggestions.

Closes #3547.
2013-08-29 16:40:38 +02:00
Martijn van Groningen 76939b82d3 Removed unnecessary catch clause.
Improved logging
2013-08-29 16:00:59 +02:00
Boaz Leskes ffd019c07e Logging shard level multi percolate errors under debug rather than trace 2013-08-29 14:15:38 +02:00
Luca Cavanna 649108656d Added logging and asserts to make it easier to understand potential failures 2013-08-29 14:10:49 +02:00
Simon Willnauer 8b617fb48f Convert relative paths to URI first in tests to prevent URL encoded paths
If a path to the test classes contains spaces Hunspell tests failed due
to URL encoded paths. This happens on CI builds if you give the build
a name containing a space. This is fixed by first converting to a URI
and created a File object from the URI directly.
2013-08-29 12:56:33 +02:00
Martijn van Groningen 25c1b93d57 Ignore AlreadyExpiredException exception during when indexing a document on a replica.
The document should just be indexed to stay consistent with the primary shard.
2013-08-29 11:38:13 +02:00
Martijn van Groningen a1f2f44eef Make sure 2 writes happened, so we can check if 2 deletes happen that have been triggered by ttl 2013-08-29 11:27:01 +02:00
Simon Willnauer 11ff90420a Fixed typo 2013-08-29 10:27:20 +02:00
Boaz Leskes e807c99f27 Fixed a typo in the config of light finnish stemmer (old last_finish is still supported for backward compatibility)
Closes #3594
2013-08-29 10:15:40 +02:00
Simon Willnauer b9558edeff Prevent allocation algorithm from prematurely exiting balance operations
In a special case if allocations from the "heaviest" to the "lighter" nodes is not possible
due to some allocation decider restrictions like zone awareness. if one zone has for instance
less nodes than another zone so one zone is horribly overloaded from a balanced perspective but we
can't move to the "lighter" shards since otherwise the zone would go over capacity.

Closes #3580
2013-08-28 23:31:35 +02:00
Simon Willnauer 82397c0554 Treat empty prefrence as a `not set` in Plain Operation Routing
An empty preference was causing a AIOOB exception in
PlainOperationRouting. We now check for `null` or `empty` instead of
just `null`

Closes #3591
2013-08-28 20:57:39 +02:00
Boaz Leskes 86cb76a0ce Added a status method CountResponse that resolve shard failures into rest status code. That method is now used in RestCountAction to return proper status.
Closes #3585
2013-08-28 20:21:22 +02:00
Shay Banon db11c30dd5 batch failed shards into a single cluster state event
make sure we process as much as possible failed shard events within a single cluster state event callback (similar to what we do with started shards)
2013-08-28 15:29:16 +02:00
Adrien Grand b63af53313 Make BytesValues documentation clearer about BytesRef ownership. 2013-08-28 15:24:51 +02:00
Martijn van Groningen e6f014bd62 no need for flush/optimize 2013-08-28 14:56:26 +02:00
Shay Banon 25d42e5caf Don't recover a shard if it just failed on this node and wasn't reassigned to this node by master yet.
additional places where we should track failed shards, and call clean as part of the top level calls
2013-08-28 14:12:07 +02:00
Igor Motov ed2740a50a Don't recover a shard if it just failed on this node and wasn't reassigned to this node by master yet.
When recovery of a shard fails on a node, the node sends notification to the master with information about the failure. During the period between the shard failure and the time when notification about the failure reaches the master, any changes in shard allocations can trigger the node with the failed shard to allocate this shard again. This allocation (especially if successful) creates a ripple effect of the shard going through failure/started states in order to match the delayed states processed by master.  Under certain condition, a node involved in this process might generate warning messages: "marked shard as started, but shard has not been created, mark shard as failed".

This fix makes sure that nodes keep track of failed shard allocations and will not try to allocate such shards repeatedly while waiting for the failure notification to be processed by master.
2013-08-28 14:12:07 +02:00
Britta Weber 513c761aee ElasticsearchAssertions.assertHitCount also checks shard failures 2013-08-28 10:47:39 +02:00
Martijn van Groningen 60ac34ff3a Added `_name` support to queries.
This extends the named filter support from only filters to also queries.

Closes #3581
2013-08-28 10:42:53 +02:00
Boaz Leskes 45d4864021 Refreshing after green so also recovering replicas will be refreshed. 2013-08-28 08:44:10 +02:00
Simon Willnauer e6dcd137a6 AwarenessAllocationTests must extend ESTestCase in order to respect AwaitsFix annotations 2013-08-27 19:28:20 +02:00
Lee Hinman 9d5868904b Recover small files (< 1mb) using a separate threadpool than large files.
Fixes #3576
2013-08-27 11:01:54 -06:00
Britta Weber 1ab037d4d0 Fix searching while shard is being relocated
Shard relocation caused queries to fail in the fetch phase either with a
`AlreadyClosedException` or a `SearchContextMissingException`.
This was caused by the `SearchService` releasing the `SearchContext`s via the
superfluous call of `releaseContextsForShard()` when the
2013-08-27 18:30:00 +02:00
Simon Willnauer e7ff8ea509 Added unit tests or zone awareness 2013-08-27 18:05:42 +02:00
Luca Cavanna d5b2c8e82f Fixed extraction of site plugins downloaded from github, so that we skip the top-level folder and we place the files directly under the _site folder
Closes #3551
2013-08-27 17:03:55 +02:00
Boaz Leskes fa067e058a MultiTermVectorsAction was wrongly registered under mget 2013-08-27 13:46:33 +02:00
Simon Willnauer 39040b5f17 Add more tests for Zone Awareness 2013-08-27 12:25:35 +02:00
Simon Willnauer 6b8dd0b08f Added log info on test finished 2013-08-27 12:03:49 +02:00
Luca Cavanna 6e19ca8080 Fixed order of parameters when calling byteSizeField and timeValueField methods (introduced with #3432 - support for human readable flag) 2013-08-27 11:48:20 +02:00
Martijn van Groningen 45699bae5a Make sure preference isn't null 2013-08-27 11:05:12 +02:00
Adrien Grand db46946d16 Configurable sort order for missing string values.
This commit allows for configuring the sort order of missing values in BytesRef
comparators (used for strings) with the following options:
 - _first: missing values will appear in the first positions,
 - _last: missing values will appear in the last positions (default),
 - <any value>: documents with missing sort value will use the given value when
   sorting.

Since the default is _last, sorting by string value will have a different
behavior than in previous versions of elasticsearch which used to insert missing
value in the first positions when sorting in ascending order.

Implementation notes:
 - Nested sorting is supported through the implementation of
   NestedWrappableComparator,
 - BytesRefValComparator was mostly broken since no field data implementation
   was using it, it is now tested through NoOrdinalsStringFieldDataTests,
 - Specialized BytesRefOrdValComparators have been removed now that the ordinals
   rely on packed arrays instead of raw arrays,
 - Field data tests hierarchy has been changed so that the numeric tests don't
   inherit from the string tests anymore,
 - When _first or _last is used, internally the comparators are told to use
   null or BytesRefFieldComparatorSource.MAX_TERM to replace missing values
   (depending on the sort order),
 - BytesRefValComparator just replaces missing values with the provided value
   and uses them for comparisons,
 - BytesRefOrdValComparator multiplies ordinals by 4 so that it can find
   ordinals for the missing value and the bottom value which are directly
   comparable with the segment ordinals. For example, if the segment values and
   ordinals are (a,1) and (b,2), they will be stored internally as (a,4) and
   (b,8) and if the missing value is 'ab', it will be assigned 6 as an ordinal,
   since it is between 'a' and 'b'. Then if the bottom value is 'abc', it will
   be assigned 7 as an ordinal since if it between 'ab' and 'b'.

Closes #896
2013-08-27 10:46:21 +02:00
Martijn van Groningen 2c939847b4 Simplified percolate reduce logic and the percolator recovery test 2013-08-27 10:45:09 +02:00
Martijn van Groningen 28e1744e79 No test is simple 2013-08-26 18:01:12 +02:00
Martijn van Groningen 29626dd201 Rename multi percolate item actions:
count_percolate -> count
percolate_existing_doc -> percolate
count_percolate_existing_doc -> count

If header contains `id` field, then it will automatically be percolation  an existing document.
2013-08-26 18:00:36 +02:00
Martijn van Groningen 3ca0239668 Added highlighter to percolate api.
The highlighter in the percolate api highlights snippets in the document being percolated. If highlighting is enabled then foreach matching query, highlight snippets will be generated.
All highlight options that are supported via the search api are also supported in the percolate api, since the percolate api embeds the same highlighter infrastructure as the search api.
The `size` option is a required option if highlighting is specified in the percolate api, other than that the `highlight`request part can just be placed in the percolate api request body.

Closes #3574
2013-08-26 16:37:07 +02:00
Martijn van Groningen df3922a22a Small cleanup 2013-08-26 15:42:19 +02:00
Martijn van Groningen 35dcdb0b5a Only use the client variable and don't use client from client() in percolator test 2013-08-26 15:37:18 +02:00
Shay Banon 8b295b53d0 Improve refresh logic when replica move to started
closes #3573
2013-08-26 15:15:01 +02:00
Shay Banon b329943632 improve search while create test
- improve the test to be more re-creatable
- have tests for various number of replica counts, to check if failures are caused by searching on replicas that might not have been refreshed yet
- improve test to test explicit index creation, and index creation caused by index operation
- have an initial search go to _primary, to check if failure fails when searching on replica because it missed a refresh
2013-08-26 14:29:40 +02:00
Martijn van Groningen 9f2e615ed9 Added extra logging 2013-08-26 09:48:04 +02:00
Boaz Leskes a96ecea653 Multi term vector request
--------------------------

This feature allows to retrieve [term vectors](https://github.com/elasticsearch/elasticsearch/issues/3114) for a list of documents. The json request has exactly the same [format](https://github.com/elasticsearch/elasticsearch/issues/3484) as the ```_termvectors``` endpoint

It use it, call

```
curl -XGET 'http://localhost:9200/index/type/_mtermvectors' -d '{
    "fields": [
        "field1",
        "field2",
        ...
    ],
    "ids": [
        "docId1",
        "docId2",
        ...
    ],
    "offsets": false|true,
    "payloads": false|true,
    "positions": false|true,
    "term_statistics": false|true,
    "field_statistics": false|true
}'

```

The return format is an array, each entry of which conatins the term vector response for one document:

```
{
   "docs": [
      {
         "_index": "index",
         "_type": "type",
         "_id": "docId1",
         "_version": 1,
         "exists": true,
         "term_vectors": {
         	...
         }
      },
      {
         "_index": "index",
         "_type": "type",
         "_id": "docId2",
         "_version": 1,
         "exists": true,
         "term_vectors": {
         ...
         }
      }
   ]
}
```

Note that, like term vectors, the mult term vectors request will silenty skip over documents that have no term vectors stored in the index and will simply return an empty response in this case.

Closes #3536
2013-08-26 09:25:21 +02:00
Boaz Leskes 18c71b16b5 Refactor term vector api
This is necessary to allow adding a mult term vector request
2013-08-26 09:25:21 +02:00
Martijn van Groningen a09f217b45 Don't reduce twice if failure occurs. 2013-08-25 21:50:04 +02:00
Simon Willnauer 020e68f2a0 Make sure all shards are refreshed during recovery test 2013-08-24 09:08:39 +02:00
Shay Banon e892ec2c37 use our abort policy in the scheduler thread pool 2013-08-23 22:03:14 +02:00
Shay Banon 7791f2612d remove unused variable 2013-08-23 21:33:14 +02:00
Simon Willnauer c688ed6c9f Don't assert a second time if awaitBusy returned successfully 2013-08-23 20:57:53 +02:00
Shay Banon 86c95ab2ab Setting index/bulk thread pools with queue_size can cause replica shard failures
closes #3526
2013-08-23 19:24:47 +02:00
Simon Willnauer 19cce0b329 Use awaiBusy rather than a tight loop in IndicesStoreTests 2013-08-23 18:04:53 +02:00
Simon Willnauer a943135ef6 Improve assertion and busy waiting for RecoveryWhileUnterLoadTests 2013-08-23 18:04:53 +02:00
Simon Willnauer 6c24a0af3e Wait for consistent view on both clients in ClusterServiceTests 2013-08-23 18:04:53 +02:00
Simon Willnauer 6d49170509 Introduce base test classes to share thread scope annotations
Currently we run unittests with clusters running in the background
that can potentiallly spawn threads causeing the thread leak control
to fire off in tests that don't use the test cluster. This commit
introduces some base classes for that purpose shadowning lucene test
framework classes adding the approriate ThreadScope.
2013-08-23 18:04:53 +02:00
Simon Willnauer 71ebb14b58 Add ESAbortPolicy to cached pools
All ES ThreadPools / Executors should use the ESAbortPolicy or at least
one that throws the ESRejectedExecutionException.
2013-08-23 18:04:53 +02:00
Simon Willnauer 7c76819040 Randomize numeric types in MLT test and apply mapping ahead of time. 2013-08-23 18:04:52 +02:00
Britta Weber 8b9396b6da add additional method for setting combine mode with CombineFunction parameter 2013-08-23 16:04:00 +02:00
Britta Weber 8d6dc5908e add builders for nicer java api
This commit and the previous 10 commits close issue 3533.

Closes #3533
2013-08-23 16:03:23 +02:00
Britta Weber 5258940d9e format code 2013-08-23 14:44:34 +02:00
Britta Weber 1b085b069b rename reference -> origin 2013-08-23 14:44:34 +02:00
Britta Weber 9e7ad7249f rename scale_weight -> decay 2013-08-23 14:44:34 +02:00
Britta Weber 41b4a14933 Add offset to decay function score
Docs within the offset will be scored with 1.0, decay only starts after
offset is reached.
2013-08-23 14:44:22 +02:00
Britta Weber c0288a62e6 rename 'total' to 'sum', both enum and for query 2013-08-23 14:44:01 +02:00
Britta Weber 6035134047 add more combine functions and rename PLAIN to REPLACE 2013-08-23 14:44:01 +02:00
Britta Weber db100aa2de make GeoPoint parsable in lat/lon json format 2013-08-23 14:43:54 +02:00
Britta Weber f125ac122c format code 2013-08-23 13:55:14 +02:00
Britta Weber 41c59c6b49 make mult default boost mode
always multiply query score to function score. For script score
functions, this means that boost_mode has to be set to `plain` if
'function_score' should behave like 'custom_score'
2013-08-23 13:55:14 +02:00
Britta Weber 634f1036a0 add boost_mode to rest interface
allow user to set combine functions explicitely via boost_mode variable.
2013-08-23 13:55:14 +02:00
Britta Weber b007af1f46 Fix inconsistent usage of ScriptScoreFunction in FiltersFunctionScoreQuery
This commit fixes inconsistencies in `function_score` and `filters_function_score`
using scripts, see issue #3464

The method 'ScoreFunction.factor(docId)' is removed completely, since the name
suggests that this method actually computes a factor which was not the case.
Multiplying the computed score is now handled by 'FiltersFunctionScoreQuery'
and 'FunctionScoreQuery' and not implicitely performed in
'ScoreFunction.factor(docId, subQueryScore)' as was the case for 'BoostScoreFunction'
and 'DecayScoreFunctions'.

This commit also fixes the explain function for FiltersFunctionScoreQuery. Here,
the influence of the maxBoost was never printed. Furthermore, the queryBoost was
printed as beeing multiplied to the filter score.

Closes #3464
2013-08-23 13:55:14 +02:00
Shay Banon 1ac00a13fb cleanup removable of reject_policy 2013-08-23 12:15:47 +02:00
Louis Gueye 048a02eebc Debian init script: Add debian default java location
Adding /usr/lib/jvm/default-java to JAVA_HOME candidates to check

Closes #3500
2013-08-23 11:27:12 +02:00
Martijn van Groningen e173f9a369 Added test for verifying the id cache size if the clear cache api is invoked. 2013-08-23 10:04:13 +02:00
Dan Everton c76e589bc5 Call onRemoval of shard IdCache during clear.
This looks like a copy/paste issue where onCached was being called
rather than onRemoval. This should fix the ID cache stats not being
correct after a call to /_cache/clear?id_cache=true
2013-08-23 09:55:51 +02:00
uboness 4b3a883111 random_score function - Added the index name and shard id to the randomization, and improved the PRNG itself
Closes #3559
2013-08-23 02:48:43 +02:00
Boaz Leskes 109e2944f2 ClusterUpdateSettingsAction will hang if no changes were made
Closes #3560
2013-08-22 20:59:31 +02:00
Simon Willnauer fc3133d087 Prevent NPE if all docs for the field are pruned during merge
During segment merges FieldConsumers for all fields from the source
segments are created. Yet, if all documents that have a value in a
certain field  are deleted / pruned during the merge the FieldConsumer
will not be called at all causing the internally used FST Builder to
return `null` from it's `build()` method. This means we can't store
it and run potentially into a NPE. This commit adds handling for
this corner case both during merge and during suggest phase since
we also don't have a Lookup instance for this segments field.

Closes #3555
2013-08-22 11:59:25 +02:00
Martijn van Groningen 7fda12316a Properly reduce in onFailure 2013-08-21 23:57:15 +02:00
David Pilato 352d2aaf18 Plugin Manager can not download _site plugins from github
Sounds like github changes a bit download url for master zip file.

From `https://github.com/username/reponame/zipball/master` to `https://github.com/username/reponame/archive/master.zip`.

We need to update plugin manager to reflect that change.

In the meantime, we invite users having this issue to use:

```sh
bin/plugin -install reponame -url https://github.com/username/reponame/archive/master.zip
```

For example:

```sh
bin/plugin -install paramedic -url https://github.com/karmi/elasticsearch-paramedic/archive/master.zip
```

Closes #3551
2013-08-21 17:44:08 +02:00
David Pilato 8668479b92 Plugin Manager can not download _site plugins from github
Sounds like github changes a bit download url for master zip file.

From `https://github.com/username/reponame/zipball/master` to `https://codeload.github.com/username/reponame/zip/master`.

We need to update plugin manager to reflect that change.

In the meantime, we invite users having this issue to use:

```sh
bin/plugin -install reponame -url https://codeload.github.com/username/reponame/zip/master
```

For example:

```sh
bin/plugin -install paramedic -url https://codeload.github.com/karmi/elasticsearch-paramedic/zip/master
```

Closes #3551
2013-08-21 16:08:00 +02:00
Shay Banon 25d28f8afa Completion Suggester: Allow payload to be a value
closes #3550
2013-08-21 15:33:52 +02:00
Alexander Reelsen 210683d70b Checking for paylods as JSON objects in completion suggester
If the payload is not a JSON object on indexation, an exception will be thrown.
2013-08-21 14:25:49 +02:00
Alexander Reelsen cdddbb7585 Expose size statistics for completion suggest
In order to determine how many RAM the completion suggest structures will eat up, this data should be exposed.

Closes #3522
2013-08-21 13:15:38 +02:00