Commit Graph

4053 Commits

Author SHA1 Message Date
Britta Weber d9a1540948 [mappings] update dynamic fields in mapping on master even if parsing fails for the rest of doc
The local DocumentMapper is updated while parsing and dynamic fields are added before
parsing has finished. If parsing fails after a dynamic field has been added already
then the field was not added to the cluster state but was present in the local mapper of this
node. New documents with the same field would not necessarily cause an update either and
after restarting the node the mapping for these fields were lost. Instead the new fields
should always be updated.

closes #9851
closes #9874
2015-03-06 15:35:23 +01:00
Martijn van Groningen dccaa49aa0 Tests: wait for discovery to be completed after both majority nodes follow a new master 2015-03-06 13:50:34 +01:00
Shay Banon 48bdd58d51 Use provided cluster state for indices service validations
Since the method can be called in an #execute event of the cluster service, we need the ability to use the cluster state that will be provided in the ClusterChangedEvent, have the ClusterState be provided as a parameter
2015-03-06 13:39:53 +01:00
Simon Willnauer c5a6767a55 [TEST] Reduce the number of fields in MLT tests 2015-03-06 11:54:27 +01:00
Martijn van Groningen 634c91a0ca Tests: added more logging 2015-03-06 11:18:24 +01:00
Britta Weber 6c79636985 [TEST] wait until mappings are added to cluster state to make sure they are persisted 2015-03-06 10:42:29 +01:00
Martijn van Groningen 0c254e9832 Zen: Node receiving a cluster state with a wrong master node should reject and throw an error.
Previously it was ignored and the publish cluster state timeout would kick in. In that case a stale master node would just wait for the inevitable and waste valuable time.
This issue was discovered by the DiscoveryWithServiceDisruptionsTests#testStaleMasterNotHijackingMajority test.

Also only perform cluster state versions and wrong master node check inside cluster state update task.
2015-03-06 08:47:32 +01:00
Lee Hinman 2d2cc764ac Revert "[TESTS] remove AwaitsFix from CircuitBreakerServiceTests"
This reverts commit 21e246f6a3.
2015-03-05 22:13:05 -07:00
Martijn van Groningen 274da68040 Test: added health call to will hold when wait when there is a cluster block, so that the refresh call doesn't fail if that is the case. 2015-03-05 20:32:23 +01:00
Zachary Tong 3131e01c9d Move GapPolicy and resolveBucketValues() to static helper methods
Will allow many reducers to share the same helper functionality without repeating code.  Chose
to put these in static helpers instead of adding to Reducer base class.  I can imagine other reducers
that aren't time-based (or don't care about contiguous buckets), which would make things like
gap policy useless.

Since these seemed more like helpers than inherent traits of a Reducer, they went into their own
static class.

Closes #9954
2015-03-05 09:50:07 -05:00
Britta Weber cea8999406 Store: Delete index folder if all shards were allocated away from a data only node
If a folder for an index was created that folder is never deleted from that node unless the index is deleted.
Data only nodes therefore can have empty folders for indices that they do not even have shards for.
This commit makes sure empty folders are cleaned up after all shards have moved away from a data only
node. The behavior is unchanged for master eligible nodes.

closes #9985
2015-03-05 15:48:41 +01:00
Colin Goodheart-Smithe 8935959cbf [TEST] removed custom index settings for all DateHistogram tests
In favour of randomising number of shards and replicas and only the extended bounds test sets number of shards and replicas explicitly
2015-03-05 10:29:22 +00:00
Britta Weber 764901a9cd [TEST] make sure update task is actually executed
The update task that was submitted in this test never got executed
if node_2 was not master.
2015-03-04 15:49:49 +01:00
Simon Willnauer 6b95a05fc7 Revert "[TEST] Enable trace logging for translog recovery"
This reverts commit 52d53e658f.
2015-03-04 15:33:28 +01:00
Martijn van Groningen f81805d7d3 Test: muted testStaleMasterNotHijackingMajority 2015-03-04 15:07:59 +01:00
Colin Goodheart-Smithe dc03912731 Merge branch 'master' into feature/aggs_2_0
Conflicts:
	src/main/java/org/elasticsearch/search/aggregations/bucket/geogrid/GeoHashGridParser.java
	src/main/java/org/elasticsearch/search/aggregations/metrics/percentiles/InternalPercentileRanks.java
	src/main/java/org/elasticsearch/search/aggregations/metrics/percentiles/InternalPercentiles.java
	src/main/java/org/elasticsearch/search/aggregations/metrics/tophits/InternalTopHits.java
	src/main/java/org/elasticsearch/search/aggregations/metrics/tophits/TopHitsAggregator.java
	src/test/java/org/elasticsearch/search/aggregations/bucket/significant/SignificanceHeuristicTests.java
2015-03-04 10:49:46 +00:00
Simon Willnauer 52d53e658f [TEST] Enable trace logging for translog recovery 2015-03-04 11:48:10 +01:00
Lee Hinman a5ab49dc70 [TESTS] Flush and refresh before querying in IndexWithShadowReplicasTests 2015-03-03 14:35:22 -07:00
Lee Hinman 94a74ddaec [CORE] Handle truncated translog gracefully
We used to handle truncated translogs in a better manner (assuming that
the node was killed halfway through writing an operation and discarding
the last operation). This brings back that behavior by catching an
`EOFException` during the stream reading and throwing a
`TruncatedTranslogException` which can be safely ignored in
`IndexShardGateway`.

Fixes #9699
2015-03-03 08:25:03 -07:00
Britta Weber a064f57bc2 [TEST] increase suite timeout for OldIndexBackwardsCompatibilityTests
Test suite times out too often and it seems this is not because of actual
failures but becasue it is a long running test.
2015-03-03 15:44:11 +01:00
Simon Willnauer 4becaffb41 [TEST] use context classloader to load testclasses 2015-03-03 14:34:13 +01:00
javanna 4ad33c30ac [TEST] Work around URI encode limitations in RestClient
We've been relying on URI for url encoding, but it turns out it has some problems. For instance '+' stays as is while it should be encoded to `%2B`. If we go and manually encode query params we have to be careful though not to run into double encoding ('+'=>'%2B'=>'%252B'). The applied solution relies on URI encoding for the url path, but manual url encoding for the query parameters. We prevent URI from double encoding query params by using its single argument constructor that leaves everything as is.

We can also revert back the expression script REST test that revealed this to its original content (which contains an addition).

Closes #9769
Closes #9946
2015-03-03 10:21:23 +01:00
Martijn van Groningen e559471948 Test: fix testStaleMasterNotHijackingMajority by waiting for the old master node to step down.
It may take some time for the old master node to step down anf for it to rejoin and that all nodes have it in the nodes list.
By waiting for the old master node to have stepped down, we can again rely on assertDiscoveryCompleted() to make sure that it has joined.
2015-03-03 08:49:14 +01:00
Lee Hinman 21e246f6a3 [TESTS] remove AwaitsFix from CircuitBreakerServiceTests
I beasted these tests for a while without failure, I would like to
re-enable them to see if they still fail.

Fixes #8710
Fixes #9270
2015-03-02 16:54:15 -07:00
Martijn van Groningen ca50221474 Test: fix DiscoveryWithServiceDisruptionsTests#isolatedUnicastNodes by starting a 4 node cluster instead of a 3 node cluster.
If the isolated unicast host is also a master node then its local cluster state gets unusable a source for pinging when the disruption stops.
All the nodes in the cluster state node list can be removed and at that time it will only ping itself and never find out about the other nodes.
(these nodes will not ping, because they are already following a new master)
2015-03-02 22:42:47 +01:00
Martijn van Groningen 7f6c65bf8e Test: increased logging 2015-03-02 21:16:24 +01:00
javanna b053fc97f6 [TEST] Make sure we restart the suite cluster after each test failure
CurrentTestFailedMarker is a RunListener that gets notified whenever a test fails, and we were using it to be able to restart the suite cluster after each failure. We were checking whether a test had failed in the @After method though, which runs before the listener gets notified, so the failed flag would always be false.

This commit makes sure that the suite cluster gets restarted not only when there are problems in the afterInternal method, but also after each test failure. In order to achieve this, we need to reset the cluster afterwards, when we get to know about both of the events (problem in afterInternal and test failure), and before resetting the currentCluster. Introduced a TestRule that keeps track of test failures and allows to execute arbitrary tasks when a test fails and when a test is completed (regardless of its result). Allows also to force the execution of the failure task (used in case of afterInternal issues rather than actual test failure).

Also updated ElasticsearchRestTests to make sure that the RestClient gets re-initialized in case we restart the suite cluster, otherwise all the subsequent tests fail. Improved this mechanism also to relate it directly to the restart of the cluster instead of checking whether the addresses have changed, which doesn't work anyway as the new cluster will use the same addresses but the client needs to be recreated anyway.

Closes #9015
2015-03-02 19:07:23 +01:00
Simon Willnauer df8206853b [TESTS] Make sure test end with ..Tests
This commit adds a simple testcase that ensures all our tests end with the right naming.

Closes #9945
2015-03-02 17:31:19 +01:00
Martijn van Groningen 68da7c05ee Test: fix npe 2015-03-02 16:41:19 +01:00
Colin Goodheart-Smithe 7c046d28bf Implementation of GapPolicy for derivative 2015-03-02 14:53:05 +00:00
Martijn van Groningen 2b00ecb5b5 Test: use assertBusy to fix timing issue 2015-03-02 15:30:39 +01:00
Britta Weber 358fd176c1 [TEST] add Tests suffix 2015-03-02 13:46:45 +01:00
Britta Weber 600cb886da [TEST] add Tests suffix 2015-03-02 13:19:23 +01:00
Tanguy Leroux c457499cb2 [Native] Use direct mapping call in Kernel32Library
This commit modifies the Kernel32Library to use direct mapping instead of a proxy class when doing native calls on Windows platforms. It also adds the "createSecurityManager" permission to the tests.policy file, and adds unit tests that should have failed when the Java security manager is enabled.

Closes #9802
2015-03-02 09:48:18 +01:00
Boaz Leskes c9b8c22850 Test: InternalEngineTests.testEnableGcDeletes missed closing translog 2015-03-01 17:14:42 +01:00
Boaz Leskes 4110c1ab6c Test: InternalEngineTests.testSegmentsWithMergeFlag should close it's translog
Also improve test suite tearDown to not fail if setUp didn't create engines, translogs etc.
2015-03-01 12:10:35 +01:00
Boaz Leskes ecbb9c03b0 Test: testOldIndexes start nodes async 2015-03-01 09:02:23 +01:00
Boaz Leskes facf87079c Test: add LoggingListener to ElasticsearchLuceneTestCase 2015-03-01 08:48:35 +01:00
Boaz Leskes eafba93919 Test: InternalEngineTests.testSimpleRecover should close snapshot 2015-03-01 08:48:14 +01:00
Boaz Leskes c346effd9c Test: InternalEngineTests - JVM specific paths + retry to clean up translogs on startUp
Files may still be locked
2015-03-01 00:51:36 +01:00
Ryan Ernst 2e797b9d55 Test: ShadowEngineTests - close translogs on tear down here too 2015-02-27 22:05:42 -08:00
Boaz Leskes 9b576763d7 Test: InternalEngineTests - close translogs on tear down 2015-02-27 21:53:25 +01:00
Ryan Ernst fe62e463e1 fix test bug leftover from #9914 2015-02-27 12:17:19 -08:00
Boaz Leskes 0cec37f3c3 Recovery: unify RecoveryState management to IndexShard and clean up semantics
We keep track of the current stage of recovery using an instance of RecoveryState which is stored on the relevant IndexShard. At the moment changes to this object are made in many places of the code, which are charged of doing it in the right order, keeping track of timers and many more. Also the changes to shard state are decoupled from the recovery stages which caused #9503.

This PR refactors this and brings all of the changes into IndexShard. It also makes all recovery follow the exact same stages and shortcut some. This is in order to keep things simple and always the same (those shortcuts didn't add anything, we ended doing it all anyway).

Also, all timer management is now folded into RecoveryState and unit tests are added.

This closes #9503 by moving the shard to post recovery only once the recovery is done (before they were decoupled), meaning that master promotion of the target shard to started can not cancel the recovery.

Closes #9902
2015-02-27 21:09:50 +01:00
Boaz Leskes 0f1c779d2c Engine: close snapshots before recovery counter
#9760 was a fix for translog leaking due to measing a delete flag. This is not needed here as we have a better solution to not loose the flag. This commit takes the changes from 1x in order  to keep the code base similar and enjoy the extra tests.

Closes #9760
2015-02-27 20:22:55 +01:00
Ryan Ernst 702b2abd1b fix compilation issue from forward port of #9916 2015-02-27 11:20:55 -08:00
Ryan Ernst dd0084de83 Mappings: Lock down _ttl field
While the parser allowed changing field type settings, these would never
have been serialized.  So this change simply removes parsing using
parseField. Backcompat will still work if a user uploads old settings
(they just would never have worked anyways, so we continue ignoring
them with 1.x, and 2.x will now error).

see #8143
closes #9914
2015-02-27 11:11:04 -08:00
Ryan Ernst 9d708e20a0 Mappings: Lock down _size field
This also changes the stored setting for _size to true (for
indexes created in 2.x).

see #8143
closes #9913
2015-02-27 11:09:52 -08:00
Ryan Ernst f87fa8172e Tests: Add back tests.cluster
This setting is used by the release script to run rest tests against
the version being released.  It used to work only for tests using
the global cluster.  Now it supercedes both SUITE and TEST scope
test clusters.

closes #9916
2015-02-27 11:08:24 -08:00
Robert Muir 4ca57ab10a Upgrade to Lucene r1662607
Closes #9915.

Squashed commit of the following:

commit cfa59f5a3f03d9d1b432980dcee6495447c1e7ea
Author: Robert Muir <rmuir@apache.org>
Date:   Fri Feb 27 12:10:16 2015 -0500

    add missing null check

commit 62fe5403068c730c0e0b6fd1ab1a0246eeef6220
Author: Robert Muir <rmuir@apache.org>
Date:   Fri Feb 27 11:31:53 2015 -0500

    Disable ExtrasFS for now, until we hook all this in properly in a separate issue.

commit 822795c57c5cf846423fad443c2327c4ed0094ac
Author: Adrien Grand <jpountz@gmail.com>
Date:   Fri Feb 27 10:12:02 2015 +0100

    Fix PercolatorTests.

commit 98b2a0a7d8298648125c9a367cb7e31b3ec7d51b
Author: Adrien Grand <jpountz@gmail.com>
Date:   Fri Feb 27 09:27:11 2015 +0100

    Fix ChildrenQueryTests.

commit 9b99656fc56bbd01c9afe22baffae3c37bb48a71
Author: Robert Muir <rmuir@apache.org>
Date:   Thu Feb 26 20:50:02 2015 -0500

    cutover apis, no work on test failures yet.
2015-02-27 12:51:36 -05:00
jaymode efbda318d0 Tests: check node ports availability when using unicast discovery
Some tests failures are seen when a node attempts to use a port that is already bound
by some other process on the test machine. This commit adds a bind to test port availability
and iterates over the port range until an available port is found. This reduces the likelihood
of a test node failing to start up due to the port already being bound.
2015-02-27 11:49:54 -05:00
Simon Willnauer ce53e20351 [CORE] Remove Restart API and remove Node#stop()
The restart API seems pretty esoteric and is entirely untested.
This commit removes it without a replacement.

Closes #9841
2015-02-27 13:58:23 +01:00
Simon Willnauer 2b8827d75c [CORE] Remove component settings from AbstractComponent
Today we have two ways of getting a setting, either with the full settings key or with only
the last part of the key where the prefix is implicit depending on the package the class is in via
component settings. this is trappy as well as confusing for users and can break easily if a class is moved
to a new package since the prefix then implicitly changes.
This commit removes the component settings from the codebase.
2015-02-27 13:01:26 +01:00
Ryan Ernst e221dc20a4 remove thread leak filter, should have been removed in #9843 2015-02-26 23:24:56 -08:00
Ryan Ernst 3b7928d568 Mappings: Lock down _field_names field
Now that we have an explicit `enabled` flag, we can lock down
the field type so it is not mungeable.

see #8143
closes #9912
2015-02-26 15:15:59 -08:00
Ryan Ernst 7181bbde26 Mappings: Remove _boost field
This has been deprecated since 1.0.0.RC1. It is finally removed here.

closes #8875
2015-02-26 15:07:07 -08:00
Ryan Ernst cc8f159a3c fix bwc test to be more lenient on error message when _field_names is
not supported
2015-02-26 14:32:50 -08:00
Ryan Ernst 78df69e6a0 Mappings: Lock down _routing field
`required` is now the only changeable settings (on indexes created after 1.x).

see #8143
closes #9895
2015-02-26 13:09:41 -08:00
Ryan Ernst 257cdcd110 Mappings: Add enabled flag for _field_names to replace disabling through index=no
Almost all of our meta fields that allow enabling/disabling have an `enabled`
setting.  However, _field_names is enabled by default, and disabling
requires setting `index=no`.  This change adds a flag similar to that
with other meta fields.

closes #9893
2015-02-26 13:01:07 -08:00
Simon Willnauer 261e21a386 [TEST] Fix NPE in ElasticsearchIntegrationTest if no indexer is provided
Closes #9907
2015-02-26 21:13:55 +01:00
Nicholas Knize b05f5ebee8 [TEST] Adding 'AwaitsFix' annotation to randomGeoCollection test
Random geo shape testing periodically fails on a known issue within Spatial4j core. A simple patch in ES will fix the issue.  For now this random test will be disabled until the patch can be applied.
2015-02-26 12:15:55 -06:00
javanna 624549b4eb [TEST] resolved a few compiler warnings in ElasticsearchIntegrationTest
Mainly simplified buildTestCluster method now that there is no global cluster anymore.
2015-02-26 17:04:31 +01:00
Simon Willnauer b3be23ea11 [TEST] filter out unassigned shards 2015-02-26 14:12:27 +01:00
javanna 46461c7730 [TEST] Remove global scope mentions
We removed the global cluster with #9781, yet there were still a few mentions of it in comments. Removed them.
2015-02-26 12:00:30 +01:00
Boaz Leskes de639961a1 Test: fix sync issues in AbstractSimpleTransportTests.testTracerLog 2015-02-26 09:40:36 +01:00
Igor Motov 476b4f1df4 Internal: stop passing default cluster name to cluster state read operations
The default cluster name was needed for backwards compatibility with pre v1.1 nodes. It's no longer needed in 2.0.
2015-02-25 16:44:28 -05:00
Boaz Leskes e9dbfa9ee6 Transport: added a simple request tracer, logging incoming and outgoing requests
The request tracer logs in TRACE level under the `transport.tracer` log and is dynamically configurable with include and exclude arrays to filter out unneeded info. By default all requests are logged with the exception of fault detection pings (fired every second).

add the notion of tracers in the MockTransportService for testing purposes

Closes #9286
2015-02-25 21:33:57 +01:00
Ryan Ernst 32e042f1c4 Mappings: Lock down _index field
see #8143
closes #9870
2015-02-25 12:24:55 -08:00
Lee Hinman 2e9ea4abaf Add support for `minimum_should_match` to `simple_query_string`
This behaves similar to the way that `minimum_should_match` works for
the `match` query (in fact it is implemented in the exact same way)

Fixes #6449
2015-02-25 11:35:33 -07:00
Christoph Büscher b16fb69315 DateMath: Fix using time zone when rounding.
Currently rounding in DateMathParser This always done in UTC, even
when another time zone is specified. This is fixed by passing the time zone
down to the rounding logic when it is specified.

Closes #9814
Closes #9885
2015-02-25 19:01:28 +01:00
Boaz Leskes 3e32dd985a Recovery: RecoveryState clean up
To support the `_recovery` API, the recovery process keeps track of current progress in a class called RecoveryState. This class currently have some issues, mostly around concurrency (see #6644 ). This PR cleans it up as well as other issues around it:

- Make the Index subsection API cleaner:
- remove redundant information - all calculation is done based on the underlying file map
- clearer definition of what is what: total files, vs reused files (local files that match the source) vs recovered files (copied over). % based progress is reported based on recovered files only.
- cleaned up json response to match other API (sadly this breaks the structure). We now properly report human values for dates and other units.
- Add more robust unit testing
- Detail flag was passed along as state (it's now a ToXContent param)
- State lookup during reporting is now always done via the IndexShard , no more fall backs to many other classes.
- Cleanup APIs around time and move the little computations to the state class as opposed to doing them out of the API

I also improved error messages out of the REST testing infra for things I run into.

Closes #6644
Closes #9811
2015-02-25 17:34:22 +01:00
Igor Motov c5ebdf11bb Snapshot/Restore: add ability to retrieve currently running snapshots
Together with #8782 it should help in the situations simliar to #8887 by adding an ability to get information about currently running snapshot without accessing the repository itself.

Closes #8887
2015-02-25 11:06:32 -05:00
Boaz Leskes 6953777c3a API: add pending tasks count to cluster health
The number of current pending tasks is useful to detect and overloaded master. This commit adds it to the cluster health API. The complete list can be retrieved from the dedicated pending tasks API.

It also adds rest tests for the cluster health variants.

Closes #9877
2015-02-25 14:58:44 +01:00
Simon Willnauer 1ed6451229 [CORE] Allow primary promotion on shadow replica without failing the shard
Today we fail the shard if we need to upgrade a replica to a primary on shadow replicas
on shared filesystem. Yet, this commit allows promotion by re-initializing on the master preventing
reallocation of all replicas.
2015-02-25 14:46:38 +01:00
Simon Willnauer 306b7b0f2b [INDICES] Schedule pending delete if index store delete fails
We try to lock all shards when an index is deleted but likely not
succeeding since shards are still active. To ensure that shards
that used to be allocated on that node get cleaned up as well we have
to retry or block on the delete until we get the locks. This is not desirable
since the delete happens on the cluster state processing thread. Instead of blocking
this commit schedules a pending delete for the index just like if we can't delete shards.
2015-02-25 14:31:18 +01:00
Simon Willnauer 98ce594ac8 [TEST] write.lock is a valid file on a cleaned index 2015-02-25 08:45:58 +01:00
Ryan Ernst be0cef0c43 Mappings: Lock down _type field
see #8143
closes #9869
2015-02-24 22:37:41 -08:00
Ryan Ernst b96bd201c1 Mappings: Lock down _id field
There are two implications to this change.
First, percolator now uses _uid internally, extracting the id portion
when needed. Second, sorting on _id is no longer possible, since you
can no longer index _id. However, _uid can still be used to sort, and
is better anyways as indexing _id just to make it available to
fielddata for sorting is wasteful.

see #8143
closes #9842
2015-02-24 14:26:22 -08:00
Simon Willnauer c54bd2f7ad [STORE] Improve safety when deleting files from the store
Today if we delete files from the index directory we never acquire the
write lock. Yet, for safety reasons we should get the write lock before
we modify / delete any files. Where we can we should leave the deletion
to the index writer and only delete that are necessary to delete ourself.
2015-02-24 21:15:19 +01:00
Igor Motov 73faa2e5ed Snapshot/Restore: Allow deletion of snapshots with corrupted snapshot files
Improve resiliency of snapshot deletion operation by allowing deletion of snapshot with corrupted snapshot files.

Closes #9534
2015-02-24 14:31:49 -05:00
Ryan Ernst d479611dc5 Tests: Use all found index files instead of static list for static bwc tests
It is a pain to add a new static index, and then have to update the old
index test.  This removes the need for the latter step.

closes #9854
2015-02-24 11:19:57 -08:00
Igor Motov 432f578807 Internal: refactor settings filtering
Refactor how settings filters are handled. Instead of specifying settings filters as filtering class, settings filters are now specified as list of settings that needs to be filtered out. Regex syntax is supported. This is breaking change and will require small change in plugins that are using settingsFilters. This change is needed in order to simplify cluster state diff implementation.

Contributes to #6295
2015-02-24 13:05:47 -05:00
Britta Weber ff8fd677cc mappings: update cluster state with type mapping also for failed indexing request
When indexing of a document with a type that is not in the mappings fails,
for example because "dynamic": "strict" but doc contains a new field,
then the type is still created on the node that executed the indexing request.
However, the change was never added to the cluster state.
This commit makes sure mapping updates are always added to the cluster state
even if indexing of a document fails.

closes #8692
relates to #8650
2015-02-24 17:41:12 +01:00
Ryan Ernst 4ee7ed987e Tests: Remove thread leak filter
Now that the global cluster is gone, we shoudln't need to ignore
thread leaks across tests.  We unfortunately still need suite level
scope, since most tests are using suite scope clusters (although
test clope clusters should really switch back to test scope thread
leaks).

closes #9843
2015-02-24 08:06:10 -08:00
Simon Willnauer 3e1c7b5a0c Remove InternalNode interface 2015-02-24 11:07:24 +01:00
Simon Willnauer 028f379781 Simplify SingleNodeTest and close propperly instead of calling stop 2015-02-24 09:40:32 +01:00
Lee Hinman f610774546 Revert "Add String to the default whitelisted receivers"
This reverts commit f493b98259.
2015-02-23 22:30:05 -07:00
Lee Hinman f493b98259 Add String to the default whitelisted receivers
Fixes #8866
2015-02-23 17:59:30 -07:00
Ryan Ernst 822ffe9e70 Mappings: Lock down _uid field
Also, cleanup writePre20Settings so it is shared across all field
mappers.

see #8143
2015-02-23 15:54:41 -08:00
Robert Muir 0fa5b87fdd Add missing @Override annotations.
These help a lot when refactoring, upgrading lucene, etc, and
can prevent code duplication (as you get a compile error for outdated stuff).

Closes #9832.
2015-02-23 17:08:28 -05:00
Simon Willnauer 668d09db08 [TEST] Don't reuse single node tests node instance across tests
Similar to the shared cluster we should not reuse the node from
singlenodetest across tests.
2015-02-23 21:13:23 +01:00
Christoph Büscher 4ef430d1e1 [Test] Add `date_histogram` test for time zone corner case
Add test case for time zone issue reported in #8209, already fixed
on master by previous changes in TimeZoneRounding classes.
2015-02-23 19:10:56 +01:00
Colin Goodheart-Smithe 2753db4685 Scripting: Removed deprecated script parameter names
This change removes the deprecated script parameter names ('file', 'id', and 'scriptField').
It also removes the ability to load file scripts using the 'script' parameter. File scripts should be loaded using the 'script_file' parameter only.
2015-02-23 13:49:21 +00:00
orenash 55ab08c537 Adding tests for timezone rounding:
1. Test using the pre_zone_adjust_large_interval option.
2. Test rounding of ambiguous timestamps in local time (after DST switch)
2015-02-23 12:55:36 +01:00
Martijn van Groningen 4fddda307f [Discovery] Prevent stale master nodes from sharing dated cluster states to nodes that have moved to a different master node.
If an elected master node goes into a long gc then other nodes' fault detection will notice this and a new master election is started and eventually a new master node is elected. If the previous master nodes goes out of the long gc it can still have pending tasks which can result in new cluster state updates. Nodes that are still in the nodes list of this previous elected master node can get these cluster state updates. This commit makes sure that this dated cluster states are not accepted by these nodes.

This issue can temporary lead to the fact that non elected master nodes switch to the previous elected master node. The new elected master node also gets the same dated cluster state, but rejects it and tells the previous elected master node to step down and rejoin. Because the new elected master is the only master node the previous elected master node will follow the new elected master node. Any nodes that follow the previous elected master node (by accident), will also rejoin and follow the new elected master node because their master fault detection will fail. So all in all this isn't a severe problem, because the problem fixes itself eventually.

Closes #9632
2015-02-23 12:28:13 +01:00
Simon Willnauer 98aad1bcbd Remove unused constant 2015-02-23 09:49:05 +01:00
Simon Willnauer 221c7b6e30 [TEST] use same type in mapping and for indexing 2015-02-23 09:41:29 +01:00
Ryan Ernst f3d5d483db Internal: Fix field mappers to always pass through index settings
Currently many meta field mappers do not take index settings in their
simple constructor that DocumentMapper uses, and instead pass null or
empty settings to the parent abstract mapper.  This change fixes them to
pass through index settings, and adds an assertion in AbstractFieldMapper
that settings are not null.

closes #9780
2015-02-22 22:14:18 -08:00
Robert Muir 1e015e6e33 Tests: Remove global shared cluster
This was previously attempted in #8854. I revived that branch and did
some performance testing as was suggested in the comments there.

I fixed all the errors, mostly just the rest tests, which
needed to have http enabled on the node settings (the global cluster
previously had this always enabled). I also addressed the comments from
that issue.

My performance tests involved running the entire test suite on my
desktop which has 6 cores, 16GB of ram, and nothing else was being
run on the box at the time. I ran each set of settings 3 times and
took the average time.

| mode    | master | patch | diff |
| ------- | ------ | ----- | ---- |
| local   | 409s   | 417s  | +2%  |
| network | 368s   | 380s  | +3%  |

This increase in average time is clearly worthwhile to pay to achieve
isolation of tests. One caveat is the way I fixed the rest tests
is still to have one cluster for the entire suite, so all the rest
tests can still potentially affect each other, but this is an
issue for another day.

There were some oddities that I noticed while running these tests
that I would like to point out, as they probably deserve some
investigation (but orthogonal to this PR):
* The total test run times are highly variable (more than a minute between the min and max)
* Running in network mode is on average actually *faster* than local mode. How is this possible!?
2015-02-22 22:04:22 -08:00
Martijn van Groningen 298f753bf2 Muted testParentFieldToNonExistingType test 2015-02-22 23:06:18 +01:00
Robert Muir a4f7023e29 set AwaitsFix until we discuss if proxies are needed 2015-02-20 17:59:17 -05:00
Simon Willnauer 1837d8a5fc fix test bug 2015-02-20 23:16:23 +01:00
Simon Willnauer 136d36b724 [ENV] NodeEnv should lock all shards for an index
Today locking all shards only locks the shards that are present on
the node or that still have a shard directory. This can lead to odd
behavior if another shard that doesn't exist yet is allocated while
all shards are supposed to be locked.
2015-02-20 22:11:10 +01:00
Ryan Ernst 94348cb788 replace awaitsfix url with underlying lucene issue for index lookup failure 2015-02-20 11:18:53 -08:00
Nicholas Knize 9302126162 [GEO] Adds randomization to geo test suite
Adds RandomShapeGenerator for creating random shape types. This adds a level of randomized testing to the Geospatial logic. An initial randomized GeometryCollection test is added to the GeoShapeIntegrationTest suite for validating and verifying geo_shape filter behavior. The RandomShapeGenerator can/should be used in Unit and Integration testing to avoid biased testing.

closes #9588
2015-02-20 11:18:14 -06:00
Adrien Grand 7c20a8a913 Mute IndexLookupTests temporarily. 2015-02-20 15:01:04 +01:00
markharwood 29b1902cfb New aggregations feature - “PercentageScore” heuristic for significant_terms aggregation provides simple “per-capita” type measures.
Closes #9720
2015-02-20 13:22:08 +00:00
Simon Willnauer 50b9a8d6f2 Add missing segments file to the lucene file listing
Relates to #9761
2015-02-20 13:14:35 +01:00
Robert Muir e8cfc11a6e add missing import 2015-02-20 07:02:25 -05:00
Robert Muir 30a4294a6a Upgrade to lucene r1660560
Squashed commit of the following:

commit 07391388715ed1f737e8acc391cea0bce5d79db9
Merge: a71cc45 b61b021
Author: Robert Muir <rmuir@apache.org>
Date:   Fri Feb 20 06:58:11 2015 -0500

    Git really sucks

    Merge branch 'lucene_r1660560' of github.com:elasticsearch/elasticsearch into lucene_r1660560

commit b61b02163f62ad8ddd9906cedb3d57fed75eb52d
Author: Adrien Grand <jpountz@gmail.com>
Date:   Wed Feb 18 19:03:49 2015 +0100

    Try to improve TopDocs.merge usage.

commit bf8e4ac46d7fdaf9ae128606d96328a59784f126
Author: Ryan Ernst <ryan@iernst.net>
Date:   Wed Feb 18 07:43:37 2015 -0800

    reenable scripting test for accessing postings pieces.  commented out
    parts that fail because of bad assumptions

commit 6d4d635b1a23b33c437a6bae70beea70ad52d91c
Author: Robert Muir <rmuir@apache.org>
Date:   Wed Feb 18 09:41:46 2015 -0500

    add some protection against broken asserts, but, also disable crappy test

commit c735bbb11f38782dfea9c4200fcf732564126bf5
Author: Robert Muir <rmuir@apache.org>
Date:   Wed Feb 18 02:21:30 2015 -0500

    cutover remaining stuff from old postings api

commit 11c9c2bea3db3ff1cd2807bd43e77b500b167aed
Author: Robert Muir <rmuir@apache.org>
Date:   Wed Feb 18 01:46:04 2015 -0500

    cut over most DocsEnum usage

commit bc18017662f6abddf3f074078f74e582494c88e2
Author: Robert Muir <rmuir@apache.org>
Date:   Wed Feb 18 01:19:35 2015 -0500

    upgrade to lucene_r1660560, modulo one test fail
2015-02-20 06:58:43 -05:00
Simon Willnauer a71cc45023 [INDICES] Retry if shard deletes fail due to IOExceptions
Today if a shard deletion fails we simply ignore it and move on. On system like
windows where a virus scanner can hold on to files or any other process ie. the admins
explorer window we fail to delete shards leaving large amout of data behind. We should try
best effort to clean those shards up before we ack the delete.
2015-02-20 12:50:40 +01:00
Simon Willnauer 8e09070246 [RESTORE] Refactor how restore cleans up files after snapshot was restored
Today we restore files by running through the directory removeing all files
not in the snapshot. Some files in that direcotry might belong there even though
we remove them. This commit moves the responsiblity of cleaning up pending files
to lucene by utilizing IndexWriter#IndexFileDeleter
2015-02-20 09:33:40 +01:00
Ryan Ernst dae0ed168a Test: Remove use of globalTempDir() and forbid it from future use.
Using this temp dir circumvents test isolation and isn't necessary.

closes #9777
2015-02-19 14:05:10 -08:00
Martijn van Groningen 16446440e4 Don't use the fixed bitset filter cache for child nested level filters, but the regular filter cache instead.
Random access based bitsets are not required for the child level nested level filters.

Closes #8810
2015-02-19 21:34:03 +01:00
Martijn van Groningen b2b7506ace inner hits: Don't fail if an object is specified as a nested value instead of an array.
Closes #9723
2015-02-19 21:18:38 +01:00
Michael McCandless 4859ce5d79 Core: include timestamp and params in hot threads
Include the timestamp and params (interval, busiestThreads,
ignoreIdleThreads), when hot threads were collected.

Closes #9773
2015-02-19 15:10:17 -05:00
Robert Muir 7dad162377 tests: minimize tests.policy a bit.
Closes #9765
2015-02-19 13:27:04 -05:00
Adrien Grand 4708227ecf Codecs: Remove the ability to have custom per-field postings and doc values formats.
This commit makes the `postings_format` and `doc_values_format` options of
mappings illegal on 2.0 and ignored on 1.x (meaning that the default postings
and doc values formats from the codec will be used in such a case).

This removes a fair amount of code.

Close #8746 #9741
2015-02-19 15:47:25 +01:00
Ryan Ernst 2a217c2d20 add static bwc indexes for 1.3.9 and 1.4.4 2015-02-19 06:26:15 -08:00
Simon Willnauer 2064ba33f2 [TEST] Never flush in the test where we rely on recovering from translog 2015-02-19 14:53:01 +01:00
Simon Willnauer 3fe2d7cda8 [TEST] Relax path clearing assertion on Windows 2015-02-19 09:34:02 +01:00
Lee Hinman eb666f7f50 Add shadow replicas for shared filesystems
Squashed commit of the following:

commit 20835037c98e7d2fac4206c372717a05a27c4790
Author: Lee Hinman <lee@writequit.org>
Date:   Wed Feb 18 15:27:17 2015 -0700

    Use Enum for "_primary" preference

commit 325acbe4585179190a959ba3101ee63b99f1931a
Author: Lee Hinman <lee@writequit.org>
Date:   Wed Feb 18 14:32:41 2015 -0700

    Use ?preference=_primary automatically for realtime GET operations

commit edd49434af5de7e55928f27a1c9ed0fddb1fb133
Author: Lee Hinman <lee@writequit.org>
Date:   Wed Feb 18 14:32:06 2015 -0700

    Move engine creation into protected createNewEngine method

commit 67a797a9235d4aa376ff4af16f3944d907df4577
Author: Lee Hinman <lee@writequit.org>
Date:   Wed Feb 18 13:14:01 2015 -0700

    Factor out AssertingSearcher so it can be used by mock Engines

commit 62b0c28df8c23cc0b8205b33f7595c68ff940e2b
Author: Lee Hinman <lee@writequit.org>
Date:   Wed Feb 18 11:43:17 2015 -0700

    Use IndexMetaData.isIndexUsingShadowReplicas helper

commit 1a0d45629457578a60ae5bccbeba05acf5d79ddd
Author: Lee Hinman <lee@writequit.org>
Date:   Wed Feb 18 09:59:31 2015 -0700

    Rename usesSharedFilesystem -> isOnSharedFilesystem

commit 73c62df4fc7da8a5ed557620a83910d89b313aa1
Author: Lee Hinman <lee@writequit.org>
Date:   Wed Feb 18 09:58:02 2015 -0700

    Add MockShadowEngine and hook it up to be used

commit c8e8db473830fce1bdca3c4df80a685e782383bc
Author: Lee Hinman <lee@writequit.org>
Date:   Wed Feb 18 09:45:50 2015 -0700

    Clarify comment about pre-defined mappings

commit 60a4d5374af5262bd415f4ef40f635278ed12a03
Author: Lee Hinman <lee@writequit.org>
Date:   Wed Feb 18 09:18:22 2015 -0700

    Add a test for shadow replicas that uses field data

commit 7346f9f382f83a21cd2445b3386fe67472bc3184
Author: Lee Hinman <lee@writequit.org>
Date:   Wed Feb 18 08:37:14 2015 -0700

    Revert changes to RecoveryTarget.java

commit d90d6980c9b737bd8c0f4339613a5373b1645e95
Author: Lee Hinman <lee@writequit.org>
Date:   Wed Feb 18 08:35:44 2015 -0700

    Rename `ownsShard` to `canDeleteShardContent`

commit 23001af834d66278ac84d9a72c37b5d1f3a10a7b
Author: Lee Hinman <lee@writequit.org>
Date:   Wed Feb 18 08:35:25 2015 -0700

    Remove ShadowEngineFactory, add .newReadOnlyEngine method in EngineFactory

commit b64fef1d2c5e167713e869b22d388ff479252173
Author: Lee Hinman <lee@writequit.org>
Date:   Wed Feb 18 08:25:19 2015 -0700

    Add warning that predefined mappings should be used

commit a1b8b8cf0db49d1bd1aeb84e51491f7f0de43b59
Author: Lee Hinman <lee@writequit.org>
Date:   Tue Feb 17 14:31:50 2015 -0700

    Remove unused import and fix index creation example in docs

commit 0b1b852365ceafc0df86866ac3a4ffb6988b08e4
Merge: b9d1fed a22bd49
Author: Lee Hinman <lee@writequit.org>
Date:   Tue Feb 17 10:56:02 2015 -0700

    Merge remote-tracking branch 'refs/remotes/origin/master' into shadow-replicas

commit b9d1fed25ae472a9dce1904eb806702fba4d9786
Merge: 4473e63 41fd4d8
Author: Lee Hinman <lee@writequit.org>
Date:   Tue Feb 17 09:02:27 2015 -0700

    Merge remote-tracking branch 'refs/remotes/origin/master' into shadow-replicas

commit 4473e630460e2f0ca2a2e2478f3712f39a64c919
Author: Lee Hinman <lee@writequit.org>
Date:   Tue Feb 17 09:00:39 2015 -0700

    Add asciidoc documentation for shadow replicas

commit eb699c19f04965952ae45e2caf107124837c4654
Author: Simon Willnauer <simonw@apache.org>
Date:   Tue Feb 17 16:15:39 2015 +0100

    remove last nocommit

commit c5ece6d16d423fbdd36f5d789bd8daa5724d77b0
Author: Simon Willnauer <simonw@apache.org>
Date:   Tue Feb 17 16:13:12 2015 +0100

    simplify shadow engine

commit 45cd34a12a442080477da3ef14ab2fe7947ea97e
Author: Simon Willnauer <simonw@apache.org>
Date:   Tue Feb 17 11:32:57 2015 +0100

    fix tests

commit 744f228c192602a6737051571e040731d413ba8b
Author: Simon Willnauer <simonw@apache.org>
Date:   Tue Feb 17 11:28:12 2015 +0100

    revert changes to IndexShardGateway - these are leftovers from previous iterations

commit 11886b7653dabc23655ec76d112f291301f98f4a
Author: Simon Willnauer <simonw@apache.org>
Date:   Tue Feb 17 11:26:48 2015 +0100

    Back out non-shared FS code. this will go in in a second iteration

commit 77fba571f150a0ca7fb340603669522c3ed65363
Merge: e8ad614 2e3c6a9
Author: Simon Willnauer <simonw@apache.org>
Date:   Tue Feb 17 11:16:46 2015 +0100

    Merge branch 'master' into shadow-replicas

    Conflicts:
    	src/main/java/org/elasticsearch/index/engine/Engine.java

commit e8ad61467304e6d175257e389b8406d2a6cf8dba
Merge: 48a700d 1b8d8da
Author: Simon Willnauer <simonw@apache.org>
Date:   Tue Feb 17 10:54:20 2015 +0100

    Merge branch 'master' into shadow-replicas

commit 48a700d23cff117b8e4851d4008364f92b8272a0
Author: Simon Willnauer <simonw@apache.org>
Date:   Tue Feb 17 10:50:59 2015 +0100

    add test for failing shadow engine / remove nocommit

commit d77414c5e7b2cde830a8e3f70fe463ccc904d4d0
Author: Simon Willnauer <simonw@apache.org>
Date:   Tue Feb 17 10:27:56 2015 +0100

    remove nocommits in IndexMetaData

commit abb696563a9e418d3f842a790fcb832f91150be2
Author: Simon Willnauer <simonw@apache.org>
Date:   Mon Feb 16 17:05:02 2015 +0100

    remove nocommit and simplify delete logic

commit 82b9f0449108cd4741568d9b4495bf6c10a5b019
Author: Simon Willnauer <simonw@apache.org>
Date:   Mon Feb 16 16:45:27 2015 +0100

    reduce the changes compared to master

commit 28f069b6d99a65e285ac8c821e6a332a1d8eb315
Author: Simon Willnauer <simonw@apache.org>
Date:   Mon Feb 16 16:43:46 2015 +0100

    fix primary relocation

commit c4c999dd61a44a7a0db9798275a622f2b85b1039
Merge: 2ae80f9 455a85d
Author: Simon Willnauer <simonw@apache.org>
Date:   Mon Feb 16 15:04:26 2015 +0100

    Merge branch 'master' into shadow-replicas

commit 2ae80f9689346f8fd346a0d3775a6341874d8bef
Author: Lee Hinman <lee@writequit.org>
Date:   Fri Feb 13 16:25:34 2015 -0700

    throw UnsupportedOperationException on write operations in ShadowEngine

commit 740c28dd9ef987bf56b670fa1a8bcc6de2845819
Merge: e5bc047 305ba33
Author: Lee Hinman <lee@writequit.org>
Date:   Fri Feb 13 15:38:39 2015 -0700

    Merge branch 'master' into shadow-replicas

commit e5bc047d7c872ae960d397b1ae7b4b78d6a1ea10
Author: Lee Hinman <lee@writequit.org>
Date:   Fri Feb 13 11:38:09 2015 -0700

    Don't replicate document request when using shadow replicas

commit 213292e0679d8ae1492ea11861178236f4abd8ea
Author: Simon Willnauer <simonw@apache.org>
Date:   Fri Feb 13 13:58:05 2015 +0100

    add one more nocommit

commit 83d171cf632f9b77cca9de58505f7db8fcda5599
Merge: aea9692 09eb8d1
Author: Simon Willnauer <simonw@apache.org>
Date:   Fri Feb 13 13:52:29 2015 +0100

    Merge branch 'master' into shadow-replicas

commit aea96920d995dacef294e48e719ba18f1ecf5860
Author: Simon Willnauer <simonw@apache.org>
Date:   Fri Feb 13 09:56:41 2015 +0100

    revert unneeded changes on Store

commit ea4e3e58dc6959a92c06d5990276268d586735f3
Author: Lee Hinman <lee@writequit.org>
Date:   Thu Feb 12 14:26:30 2015 -0700

    Add documentation to ShadowIndexShard, remove nocommit

commit 4f71c8d9f706a0c1c39aa3a370efb1604559d928
Author: Lee Hinman <lee@writequit.org>
Date:   Thu Feb 12 14:17:22 2015 -0700

    Add documentation to ShadowEngine

commit 28a9d1842722acba7ea69e0fa65200444532a30c
Author: Lee Hinman <lee@writequit.org>
Date:   Thu Feb 12 14:08:25 2015 -0700

    Remove nocommit, document canDeleteIndexContents

commit d8d59dbf6d0525cd823d97268d035820e5727ac9
Author: Lee Hinman <lee@writequit.org>
Date:   Thu Feb 12 10:34:32 2015 -0700

    Refactor more shared methods into the abstract Engine

commit a7eb53c1e8b8fbfd9281b43ae39eacbe3cd1a0a6
Author: Simon Willnauer <simonw@apache.org>
Date:   Thu Feb 12 17:38:59 2015 +0100

    Simplify shared filesystem recovery by using a dedicated recovery handler that skip
    most phases and enforces shard closing on the soruce before the target opens it's engine

commit a62b9a70adad87d7492c526f4daf868cb05018d9
Author: Simon Willnauer <simonw@apache.org>
Date:   Thu Feb 12 15:59:54 2015 +0100

    fix compile error after upstream changes

commit abda7807bc3328a89fd783ca7ad8c6deac35f16f
Merge: f229719 35f6496
Author: Simon Willnauer <simonw@apache.org>
Date:   Thu Feb 12 15:57:28 2015 +0100

    Merge branch 'master' into shadow-replicas

    Conflicts:
    	src/main/java/org/elasticsearch/index/engine/Engine.java

commit f2297199b7dd5d3f9f1f109d0ddf3dd83390b0d1
Author: Simon Willnauer <simonw@apache.org>
Date:   Thu Feb 12 12:41:32 2015 +0100

    first cut at catchup from primary
    make flush to a refresh
    factor our ShadowIndexShard to have IndexShard be idential to the master and least intrusive

    cleanup abstractions

commit 4a367c07505b84b452807a58890f1cbe21711f27
Author: Simon Willnauer <simonw@apache.org>
Date:   Thu Feb 12 09:50:36 2015 +0100

    fix primary promotion

commit cf2fb807e7e243f1ad603a79bc9d5f31a499b769
Author: Lee Hinman <lee@writequit.org>
Date:   Wed Feb 11 16:45:41 2015 -0700

    Make assertPathHasBeenCleared recursive

commit 5689b7d2f84ca1c41e4459030af56cb9c0151eff
Author: Lee Hinman <lee@writequit.org>
Date:   Wed Feb 11 15:58:19 2015 -0700

    Add testShadowReplicaNaturalRelocation

commit fdbe4133537eaeb768747c2200cfc91878afeb97
Author: Lee Hinman <lee@writequit.org>
Date:   Wed Feb 11 15:28:57 2015 -0700

    Use check for shared filesystem in primary -> primary relocation

    Also adds a nocommit

commit 06e2eb4496762130af87ce68a47d360962091697
Author: Lee Hinman <lee@writequit.org>
Date:   Wed Feb 11 15:21:32 2015 -0700

    Add a test checking that indices with shadow replicas clean up after themselves

commit e4dbfb09a689b449f0edf6ee24222d7eaba2a215
Author: Lee Hinman <lee@writequit.org>
Date:   Wed Feb 11 15:08:18 2015 -0700

    Fix segment info for ShadowEngine, remove test nocommit

commit 80cf0e884c66eda7d59ac5d59235e1ce215af8f5
Author: Lee Hinman <lee@writequit.org>
Date:   Wed Feb 11 14:30:13 2015 -0700

    Remove nocommit in ShadowEngineTests#testFailStart()

commit 5e33eeaca971807b342f9be51a6a566eee005251
Author: Lee Hinman <lee@writequit.org>
Date:   Wed Feb 11 14:22:59 2015 -0700

    Remove overly-complex test

commit 2378fbb917b467e79c0262d7a41c23321bbeb147
Author: Lee Hinman <lee@writequit.org>
Date:   Wed Feb 11 13:45:44 2015 -0700

    Fix missing import

commit 52e9cd1b8334a5dd228d5d68bd03fd0040e9c8e9
Author: Lee Hinman <lee@writequit.org>
Date:   Wed Feb 11 13:45:05 2015 -0700

    Add a test for replica -> primary promotion

commit a95adbeded426d7f69f6ddc4cbd6712b6f6380b4
Author: Lee Hinman <lee@writequit.org>
Date:   Wed Feb 11 12:54:14 2015 -0700

    Remove tests that don't apply to ShadowEngine

commit 1896feda9de69e4f9cf774ef6748a5c50e953946
Author: Lee Hinman <lee@writequit.org>
Date:   Wed Feb 11 10:29:12 2015 -0700

    Add testShadowEngineIgnoresWriteOperations and testSearchResultRelease

commit 67d7df41eac5e10a1dd63ddb31de74e326e9d38b
Author: Lee Hinman <lee@writequit.org>
Date:   Wed Feb 11 10:06:05 2015 -0700

    Add start of ShadowEngine unit tests

commit ca9beb2d93d9b5af9aa6c75dbc0ead4ef57e220d
Merge: 2d42736 57a4646
Author: Simon Willnauer <simonw@apache.org>
Date:   Wed Feb 11 18:03:53 2015 +0100

    Merge branch 'master' into shadow-replicas

commit 2d42736fed3ed8afda7e4aff10b65d292e1c6f92
Author: Simon Willnauer <simonw@apache.org>
Date:   Wed Feb 11 17:51:22 2015 +0100

    shortcut recovery if we are on a shared FS - no need to compare files etc.

commit 24d36c92dd82adce650e7ac8e9f0b43c83b2dc53
Author: Simon Willnauer <simonw@apache.org>
Date:   Wed Feb 11 17:08:08 2015 +0100

    utilize the new delete code

commit 2a2eed10f58825aae29ffe4cf01aefa5743a97c7
Merge: 343dc0b 173cfc1
Author: Simon Willnauer <simonw@apache.org>
Date:   Wed Feb 11 16:07:41 2015 +0100

    Merge branch 'master' into shadow-replicas

    Conflicts:
    	src/main/java/org/elasticsearch/gateway/GatewayMetaState.java

commit 343dc0b527a7052acdc783ac5abcaad1ef78dbda
Author: Simon Willnauer <simonw@apache.org>
Date:   Wed Feb 11 16:05:28 2015 +0100

    long adder is not available in java7

commit be02cabfeebaea74b51b212957a2a466cfbfb716
Author: Lee Hinman <lee@writequit.org>
Date:   Tue Feb 10 22:04:24 2015 -0700

    Add test that restarts nodes to ensure shadow replicas recover

commit 7fcb373f0617050ca1a5a577b8cf32e32dc612b0
Author: Simon Willnauer <simonw@apache.org>
Date:   Tue Feb 10 23:19:21 2015 +0100

    make test more evil

commit 38135af0c1991b88f168ece0efb72ffe9498ff59
Author: Simon Willnauer <simonw@apache.org>
Date:   Tue Feb 10 22:25:11 2015 +0100

    make tests pass

commit 05975af69e6db63cb95f3e40d25bfa7174e006ea
Author: Lee Hinman <lee@writequit.org>
Date:   Mon Jan 12 18:44:29 2015 +0100

    Add ShadowEngine
2015-02-18 15:34:06 -07:00
Simon Willnauer cef1c97ad4 [TEST] Add percolate type to the mapping 2015-02-18 16:06:28 +01:00
Christoph Büscher 6d41601b4e Aggregations: Format bucket key_as_string in `date_histogram` according to `time_zone`
Change bucket key_as_string to reflect `time_zone` parameter. Currently `time_zone`
shifts bucket boundaries to other time zone, but keys are displayed in UTC, so e.g.
daily buckets in "+01:00" time zone have key_as_string like "2014-01-01T23:00:00Z". With this
change the default is to format this dates according to the local time zone, so the
above bucket key would be "2014-01-02T00:00:00+01:00".

Closes #9710
Closes #9744
2015-02-18 15:49:38 +01:00
Simon Willnauer 4125e406c7 [TEST] prevent stackoverflow in mockInternalEngine 2015-02-18 14:40:22 +01:00
Colin Goodheart-Smithe bcaf22eac3 Merge branch 'master' into feature/aggs_2_0 2015-02-18 13:22:22 +00:00
Simon Willnauer 8c3cb6c613 [TEST] don't cache store stats in tests that ensure stats are correct 2015-02-18 14:02:23 +01:00
Simon Willnauer dd740c2763 [TEST] remove wrong assertion - stream must be closed to assert the size 2015-02-18 13:54:14 +01:00
Simon Willnauer ddd16deb1d [ENGINE] Flush IndexWriter to disk on close and shutdown
Today we trash everything that has been indexed but not flushed to disk
if the engine is closed. This might not be desired if we shutting down a
node for restart / upgrade or if we close / archive an index. In such a
case we would like to flush the transaction log and commit everything to
disk. This commit adds a flag to the close method that is set on close
and shutdown but not when we remove the shard due to relocations
2015-02-18 13:41:28 +01:00
Simon Willnauer 85c611a1b7 [STORE] Add simple cache for StoreStats
this commit tries to reduce the filesystem calls to fetch metadata
by using a simple cache on top of the stats call.

Relates to #9683
2015-02-18 12:29:39 +01:00
Michael McCandless a7e238dbb8 Test: include dir listing when check index fails 2015-02-18 04:31:53 -05:00
Martijn van Groningen add4339446 Added nested scope to query parse context that keeps track the current nested level during search request parsing.
The nested scope is set by any nested feature, so that sub nested queries and filters know about their context and these sub nested queries and filters can construct the right parent filter.
Removed the LateBindingParentFilter workaround in the nested query parser in favour of the nested scope maintained in the query parse context.
Due to this change nested queries and filters can now also be included in nested sorting and inner hits, because those features also now use the nested scope.

This change doesn't fix the usage of nested filters in nested and reverse_nested aggregations. The `nested` filter shouldn't be used inside these aggregations and instead the `nested` and `reverse_nested` aggs should be used to query on the right level. In a different change `nested` inside a `nested` and `reverse_nested` aggregation should result in a parse error.

Closes #9305
2015-02-17 17:53:46 +01:00
Colin Goodheart-Smithe 5a2c4ab5ae Added test for second_derivative 2015-02-17 11:37:28 +00:00
Colin Goodheart-Smithe 7f844660a8 Cleaning up NOCOMMITs 2015-02-17 11:31:24 +00:00
Colin Goodheart-Smithe 6c12cfd465 updated derivative tests to test _count 2015-02-17 11:15:04 +00:00
Simon Willnauer 2e3c6a9118 [ENGINE] Move more methods into abstract Engine 2015-02-17 11:04:46 +01:00
Colin Goodheart-Smithe f68bce51f1 Tests for derivative reducer
Most tests have been marked with @AwaitsFix since they require functionality to be implemented before they will pass
2015-02-17 09:05:24 +00:00
Simon Willnauer 1b8d8da648 [TEST] use util method to propperly shudtown threadpools 2015-02-17 09:32:50 +01:00
Christoph Büscher 30fd70f07b Aggregations: Simplify time zone option in `date_histogram`
Removed the existing `pre_zone` and `post_zone` option in `date_histogram` in favor of
the simpler `time_zone` option. Previously, specifying different values for these could
lead to confusing scenarios where ES would return bucket keys that are not UTC.
Now `time_zone` is the only option setting, the calculation of date buckets to take place in the
preferred time zone, but after rounding converting the bucket key values back to UTC.

Closes #9062
Closes #9637
2015-02-16 16:54:06 +01:00
Alex Ksikes 455a85dc3b Term Vectors: requests are now timed
When asking for term statistics, generating term vectors on the fly or with
`dfs` set to `true`, some requests may take a while, so it is useful to know
exactly how long.

Closes #9583
2015-02-16 14:08:15 +01:00
Colin Goodheart-Smithe 63f3281f12 Merge branch 'master' into feature/aggs_2_0 2015-02-16 09:27:27 +00:00
Christoph Büscher c597d8d56b Aggregations: Prevent negative intervals in date_histogram
Negative settings for interval in date_histogram could lead to OOM errors in conjunction
with min_doc_count=0. This fix raises exceptions in the histogram builder and the
 TimeZoneRounding classes so that the query fails before this can happen.

Closes #9634
Closes #9690
2015-02-13 16:05:46 +01:00
Simon Willnauer 09eb8d1383 [RECOVERY] Handle corruptions during recovery finalization
Today we sometimes have to transfer files without verifying the checksum
ie. if the file had an old alder32 checksum but was using random access
while writing such that we can only verify they files length. We will likely
not detect corruptions there and with the new checks during recovery finalization
we might run into corrupt index exceptions in that stage. This causes
the primary to be failed as well since we don't handle the exception today. This commit
adds better handling and a test for this scenario.
2015-02-13 12:10:37 +01:00
javanna 8c0ea251f7 [TEST] declare support for groovy-scripting feature in the Java REST tests runner
Groovy was disabled by default, but we turn it on in our test infra. We can then declare support for it so we go and execute script related tests as part of the REST tests suite.
2015-02-13 16:18:28 +11:00
javanna c8b9228dd6 [TEST] allow to disable REST spec validation
With #9629 we introduced REST spec validation, which barfs whenever the REST spec don't follow the defined conventions. That said, we sometimes execute tests against previous branches and tags which have spec that needs fixing but we can't go back and fix them. We now support the `-Dtests.rest.validate_spec` system property that allows to turn off REST spec validation (enabled by default) so that we can still run tests against old branches/tags.
2015-02-13 15:50:34 +11:00
Ryan Ernst 1e67b9edbd Fix test failure resulting from #8872 change. 2015-02-12 13:59:59 -08:00
Ryan Ernst 533fdbdf75 Mappings: Remove support for field access by short name
When multiple fields under object fields share the same name, accessing
by short name is ambiguous.  This removes support for short names,
always requiring the full name when used in queries.

closes #8872
2015-02-12 09:58:37 -08:00
Alexander Reelsen ce24e10783 Testing: Ensure RepeatOnExceptionRule is available in test-jar
This moves the rule, so it is made available in the test.jar. In
addition, you can now specify the exception, which triggers a rerun
of the test in order to make it reusable for others.

Also ensured that the NettyTransportTest frees all resources inside
of its testing method instead of pre/post running methods, as those
are still called only once, even though a failed test might be repeated.
2015-02-12 15:12:54 +01:00
Christoph Büscher 41befaf6b5 Change behaviour of indices segments api to allow no indices
Using '_cat/segments' or the indices segments api without matching any index
now returns empty result instead of throwing IndexMissingException.

Closes #9219
2015-02-12 14:42:15 +01:00
Colin Goodheart-Smithe 1e947c8d17 Reducers are now parsed in AggregatorParsers 2015-02-12 13:37:16 +00:00
Colin Goodheart-Smithe c60bb4d73b Adds reducers list to InternalAggregation.reduce()
The list of reducers is fed through from the AggregatorFactory
2015-02-12 13:36:05 +00:00
Adrien Grand de41981373 Aggs: Refactor aggregations to use lucene5-style collectors.
Aggregators now return a new collector instance per segment, like Lucene 5 does
with its oal.search.Collector API. This is important for us because things like
knowing whether the field is single or multi-valued is only known at a segment
level.

In order to do that I had to change aggregators to notify their sub aggregators
of new incoming segments (pretty much in the spirit of #6477) while everything
used to be centralized in the AggregationContext class. While this might slow
down a bit deeply nested aggregation trees, this also makes the children
aggregation and the `breadth_first` collection mode much better options since
they can now only replay what they need while they used to have to replay the
whole aggregation tree.

I also took advantage of this big refactoring to remove some abstractions that
were not really required like ValuesSource.MetaData or BucketAnalysisCollector.
I also splitted Aggregator into Aggregator and AggregatorBase in order to
separate the Aggregator API from implementation helpers.

Close #9544
2015-02-12 14:13:31 +01:00
javanna 4e94be8a37 [TEST] Introduce basic validation of our REST spec
Whenever we have an api that supports GET with a body, we always support the POST method too, as well as providing the body as a query_string parameter called `source`. Our REST spec should reflect this convention. FIxed them and introduced a hard check at parse time in our Java REST tests runner, which will cause the tests to fail if spec are not compliant.

Closes #9629
2015-02-12 22:25:17 +11:00
Alexander Reelsen 9cd14a5c29 CliTool: Add command to warn on permission/owner change
When using the CLI tool infrastructure, a command can potentially write
a new file. In case it overwrites an existing one, you may want to ensure
that the permissions, the owner and the group are kept the same and do not
accidentally change when overwriting those files.

This PR introduces a command that allows you to execute this check per path.

It also adds a new testing dependency, namely jimfs, which allows you to create
in-memory filesystems with certain properties (like supporting or not posix permissions
on this filesystem), so that you can test those features, without executing
tests on a certain operating system.
2015-02-12 10:10:11 +01:00
Alexander Reelsen 30a9d97a71 FileSystemUtils: Only create backup copies if files differ
The FileSystemUtils class has a helper method to create files with
a .new suffix, in case the file, which should be created already
exists. If you install plugins and those have configuration files,
even without changes, you will end up with tons of .new files.

This commit checks the file size and sha-256 sum, and only if those
differ, a .new file is actually being created.
2015-02-12 10:08:14 +01:00
Igor Motov 9b75d3ef98 Test: wait for the cluster to recover in ClusterServiceTests before waiting for update state task results
On CI machines node recovery sometimes takes up to 2 seconds. When it happens an update cluster state task gets stuck behind the recovery and tests fail with 1 second timeout. This commit makes sure that we wait for recovery to complete before starting the clock.
2015-02-11 19:11:00 -05:00
Ryan Ernst f735baf306 Core: Remove ability to run optimize and upgrade async
This has been very trappy. Rather than continue to allow buggy behavior
of having upgrade/optimize requests sidestep the single shard per node
limits optimize is supposed to be subject to, this removes
the ability to run the upgrade/optimize async.

closes #9638
2015-02-11 11:30:27 -08:00
Ryan Ernst 54c1813920 Tests: Add forgotten files for static bwc tests 2015-02-11 07:07:40 -08:00
Ryan Ernst 7328aa1c15 Tests: Add static bwc tests for new releases 1.3.8 and 1.4.3 2015-02-11 07:06:17 -08:00
Simon Willnauer 764fda6420 [TEST] make sandbox settings explicit in Tests 2015-02-11 13:21:43 +01:00
Simon Willnauer 2f0d158692 [CORE] Consolidate index / shard deletion in IndicesService
Today the logic related to deleting an index is spread across several
classes which makes changes to this rather delicate part of the code-base
very difficult. This commit consolidates this logic into the IndicesService
and moves the handling of ack-ing the delete to the master entirely into
`IndicesClusterStateService`.
2015-02-11 09:05:20 +01:00
Simon Willnauer d3762d6427 [TEST] Make tests pass while flying 2015-02-11 09:05:18 +01:00
Igor Motov 00b5c6431c Test: testSortMinValueScript - use unmappedType to handle slow propagation of mapping 2015-02-10 19:59:51 -05:00
Ryan Ernst b3474f6b25 Mappings: Remove ability to set path for _id and _routing on 2.0+ indexes
_id and _routing now no longer support the 'path' setting on indexes
created with 2.0.  Indexes created before 2.0 still support this
setting for backcompat.

closes #6730
2015-02-10 10:53:44 -08:00
Igor Motov 6544890e14 Internal: promptly cleanup updateTask timeout handler
Improve cleanup of updateTask timeout handlers. The timeout handlers should be removed as soon as a corresponding update task is processed. Otherwise, timeout handlers might keep old updateTasks and all objects that they are pointing to in memory for the duration of timeout (15 minutes by default).

Fixes #9621
2015-02-10 13:00:40 -05:00
Simon Willnauer 401e6c6b06 [ENGINE] Factor out settings updates from Engine
The engine is already pretty complex, it's still confulated with
code that doesn't necessarily belong there. Updateing the settings from
the settings service can be done on the level above. This commit cleans up
the settings code in the engine and moves it to the IndexShard.
2015-02-10 12:59:12 +01:00
Simon Willnauer de7461efd0 [ENGINE] Close Engine immediately if a tragic event strikes.
Until lately we couldn't close the engine in a tragic event due to
some the lock order and all it's complications. Now that the engine
is much more simplified in terms of having a single IndexWriter etc.
we don't necessarily need the write-lock on close anymore and can
easily just close and continue.
2015-02-09 23:21:53 +01:00
Lee Hinman 622d2c8e42 [CORE] Refactor InternalEngine into AbstractEngine and classes
InternalEngine contains a number of inner classes that it uses, however,
this makes the class overly large and hard to extend. In order to be
able to easily add other Engines (such as the ShadowEngine), these
helping methods have been extracted into an AbstractEngine class. The
classes that were previously in `InternalEngine` have been moved to
separate classes, which will allow for better unit testing as well.

None of the functionality of InternalEngine has been changed, this is
only refactoring.

Note that this is a change I originally made on my shadow-replica
branch, however it is easier to review piecemeal so I extracted it into
a separate PR.
2015-02-09 13:28:55 -07:00
Igor Motov dcc15a6460 Test: add wait for nodes to restorePersistentSettingsTest
Sometimes by the time update settings is called the second node is not in the cluster yet. As a result change of minimum master node settings to 2 is ignored making this test to fail.
2015-02-09 12:51:48 -05:00
Christoph Büscher d2f852a274 Aggregations: Add 'offset' option to date_histogram, replacing 'pre_offset' and 'post_offset'
Add offset option to 'date_histogram' replacing and simplifying the previous 'pre_offset' and 'post_offset' options.
This change is part of a larger clean up task for `date_histogram` from issue #9062.
2015-02-09 14:03:28 +01:00
Alexander Reelsen 98a2482825 Testing: Add test rule to repeat tests on binding exceptions
Due to the possibility of ports being already used when choosing a
random port, it makes sense to simply repeat a unit test upon a bind
exception.

This commit adds a junit rule, which does exactly this and does not
require you to change the test code and add loops.

Closes #9010
2015-02-09 11:18:00 +01:00
Boaz Leskes 1167beed48 Test: testRelocationWithBusyClusterUpdateThread - listener should wait for replicas to be created 2015-02-07 10:54:21 +01:00
Robert Muir 9c9b5c27d3 Upgrade to Lucene r1657571.
Closes #9587

Squashed commit of the following:

commit 23ac91dca4b949638ca1d3842fd6db2e00ee1d36
Author: Adrien Grand <jpountz@gmail.com>
Date:   Thu Feb 5 18:42:28 2015 +0100

    Do not compute scores if aggregations do not need it (like top_hits) or use a script (which might compute scores).

commit 51262fe2681c067337ca41ab88096ef80a2e8ebb
Author: Adrien Grand <jpountz@gmail.com>
Date:   Thu Feb 5 15:58:38 2015 +0100

    Fix more compile errors.

commit a074895d55b8b3c898d23f7f5334e564d5271a56
Author: Robert Muir <rmuir@apache.org>
Date:   Thu Feb 5 09:31:22 2015 -0500

    fix a few more obvious ones

commit 399c41186cb3c9be70107f6c25b51fc4844f8fde
Author: Robert Muir <rmuir@apache.org>
Date:   Thu Feb 5 09:28:32 2015 -0500

    fix some collectors and queries

commit 5f46c2f846c5020d5749233b71cbe66ae534ba51
Author: Robert Muir <rmuir@apache.org>
Date:   Thu Feb 5 09:24:24 2015 -0500

    upgrade to lucene r1657571
2015-02-06 08:53:20 -05:00
Boaz Leskes 487ef80c35 Test: testRelocationWithBusyClusterUpdateThread - CountDownLatch.countDown should be await 2015-02-06 14:31:19 +01:00
Boaz Leskes 45ecb49a09 Test: testRelocationWithBusyClusterUpdateThread - use cluster state listener instead of assertBusy 2015-02-06 14:27:27 +01:00
Boaz Leskes 1b7920f202 Test: add document indexing back to testCancellationCleansTempFiles
It was lost during a merge conflict in 796aa5c3fe2424390a8edee604cd292b8afdf514
2015-02-06 12:54:30 +01:00
Boaz Leskes 23022227d4 Recovery: add a timeout to local mapping change check
After phase1 of recovery is completed, we check that all pending mapping changes have been sent to the master and processed by the other nodes. This is needed in order to make sure that the target node has the latest mapping (we just copied over the corresponding lucene files). To make sure we do not miss updates, we do so under a local cluster state update task. At the moment we don't have a timeout when waiting on the task to be completed. If the local node update thread is very busy, this may stall the recovery for too long. This commit adds a timeout (equal to `indices.recovery.internal_action_timeout`) and upgrade the task urgency to `IMMEDIATE`. If we fail to perform the check, we fail the recovery.

Closes #9575
2015-02-06 10:06:47 +01:00
Ryan Ernst c6968883a7 Mappings: Remove support for new indexes using path setting in
object/nested fields or index_name in any field

Backcompat is still here for indexes created before 2.0.

closes #6677
2015-02-05 12:44:43 -08:00
Boaz Leskes f7fe6b7461 Test: add awaitFix to testFullRollingRestart 2015-02-05 13:00:03 +01:00
Boaz Leskes 1b8c0056d3 Test: StaticIndexBackwardCompatibilityTest.unloadIndex should call assertAllFilesClosed
That method checks that files were release properly, but also clears a static map holding references to mock directories. Since we iterate on many indexes this created memory pressure.
2015-02-05 12:12:25 +01:00
Boaz Leskes 97ac2f5144 Test: add awaitFix to SearchWithRandomExceptionsTests
disabling this until further discussion. Recent failures probably relate to #9211 & #8720 (+ friends)
2015-02-05 11:41:02 +01:00
Masaru Hasegawa b4f7d26723 Fielddata: Change threshold value of fielddata.filter.frequency.max/min
Make it consider 1.0 as 100% instead of aboslute count 1.

Closes: #9327
2015-02-05 13:27:42 +09:00
Reuben Sutton 2436552840 Raise an exception on an array of values being sent as the factor for a field_value_factor query
closes #7408
2015-02-04 14:17:09 -07:00
Simon Willnauer 4732ef3484 [ENGINE] Remove FlushType and make resources final in InternalEngine
This commit removes the FlushType entirely and replaces it in the most places with
a simple `Engine#flush()` call. Flushing without committing the translog is now
entirely private to the engine and is only called in one place.
2015-02-04 18:42:58 +01:00
Simon Willnauer 0c5599e1d1 [ENGINE] Remove full flush / FlushType.NEW_WRITER
The `full` option and `FlushType.NEW_WRITER` only exists to allow
realtime changes to two settings (`index.codec` and `index.concurrency`).
Those settings are very expert and don't really need to be updateable
in realtime.
2015-02-04 17:38:05 +01:00
Boaz Leskes 7beaaaef62 Discovery: publishing timeout to log at WARN and indicate pending nodes
When the master publishes a new cluster state it waits (by default) for up to 30s for all nodes to respond. If not it continues to process other pending tasks. At the moment, this timeout is logged under DEBUG but it typically represent a serious issue with one or more of the nodes. We should log it in WARN and give the nodes that failed to respond in a timefly fashion

Closes #9551
2015-02-04 16:39:01 +01:00
javanna 74c7b5a197 Internal: add AliasesRequest interface to mark requests that manage aliases
We currently have the IndicesRequest interface to mark indices related requests and be able to retrieve the indices they relate to in a generic way. This commit introduces a similar abstraction for requests that manage aliases, to be able to retrieve/replace the aliases they relate to.

Also, IndicesAliasesRequest becomes a CompositeIndicesRequest, as it allows to perform multiple operations (e.g. add/remote multiple aliases). Each single operation (AliasActions) implements now the newly introduced AliasesRequest.

AliasesRequest is also implemented by GetAliasesRequest, which allows to retrieve aliases information.

Closes #9460
2015-02-04 07:59:33 +01:00
Boaz Leskes 896e8657ea Discovery: check index uuid when merging incoming cluster state into local
In big deployment ClusterState can be large. To make sure we keep reusing objects that were promoted to the Old Gen, ZenDiscovery has an optimization where it tries to reuse existing IndexMetaData object (containing among other things the mappings) from the current cluster state if they didn't change. The comparison currently uses the index name and the metadata version. This is however not enough and we should also check the index uuid. In extreme cases, where cluster state processing is slow and the index in question is deleted and recreated and these operations are batch processed together, we can use the wrong meta data if the version is also identical. This can happen if people create the index with all meta data predefined and no settings were changed.

Closes #9489
Closes #9541
2015-02-03 21:36:05 +01:00
Adrien Grand 13b64cc362 Aggs: Make the nested aggregation call sub aggregators with doc IDs in order.
Close #9547
2015-02-03 16:51:36 +01:00
javanna ebb7ecb00e [TEST] RestClient to use a non static pooling connection manager
When closing an instance of RestClient, the connection manager gets shutdown, which makes it not usable anymore. If that is static, like it is now, no RestClient will work anymore from that moment on. Each instance of RestClient should have its own instance of connection manager
2015-02-03 16:46:54 +01:00
Adrien Grand 8540a863aa Search: Avoid calling DocIdSets.toSafeBits.
This method is heavy as it builds a bitset out of a DocIdSet in order to be
able to provide random-access. Now that Lucene has removed out-of-order scoring
true random-access is very rarely needed and we could instead return an Bits
instance that wraps the iterator. Ideally, we would use the DISI API directly
but I have to admit that the Bits API is more friendly.

Close #9546
2015-02-03 16:16:19 +01:00
javanna e5b174ff77 [TEST] Move SimpleNettyTransportTests to expected exception
Replaced try catch with expected exception, since no additional check was done on the exception thrown.
2015-02-03 15:51:51 +01:00
javanna 338766fd4d [TEST] Remove needless ClusterScope annotation from NettyTransportMultiPortTests
NettyTransportMultiPortTests is not an integration test, it doesn't rely on the test cluster thus the ClusterScope annotation doesn't have any effect.
2015-02-03 15:51:44 +01:00
javanna 0e67dda15d [TEST] Make sure that match assertion throws error if run against an object
We had a REST test that relied on matching a json response against a regex. It worked but the match wasn't done against the actual json object, but its java map representation converted into a string by calling `toString`. Since all other clients test runners don't work in this case, as they try to match a json object against a regex, we should do the same and prevent it from working.
2015-02-03 10:18:18 +01:00
javanna dfe67da013 [TEST] support stashed values within property names in our REST tests
Closes #9533
2015-02-03 10:17:50 +01:00
Boaz Leskes 4342237acf Test: reduce load in RecoveryWhileUnderLoadTests 2015-02-03 09:32:42 +01:00
Robert Muir 027730006b core: add 'checksum' option for index.shard.check_on_startup
The current "checkindex" on startup is very very expensive. This is
like running one of the old school hard drive diagnostic checkers and
usually not a good idea.

But we can do a CRC32 verification of files. We don't even need to
open an indexreader to do this, its much more lightweight.

This option (as well as the existing true/false) are randomized in
tests to find problems.

Also fix bug where use of the current option would always leak
an indexwriter lock.

Closes #9183
2015-02-03 00:10:08 -05:00
Ryan Ernst 6079d88d43 Mappings: Remove type prefix support from field names in queries
This is the first part of #8872.
2015-02-02 13:10:56 -08:00
Lee Hinman 0f405e9710 Merge branch 'pr/8795' 2015-02-02 11:49:45 -07:00
Michael McCandless e29cf903c8 Core: upgrade to Lucene snapshot r1656366
* IndexWriter deadlock and DV update concurrency fix
  * BytesRef reuse bug with SortedSetDVTermsEnum
  * Int overflow skip data corruption bug
  * Compound file API cleanups
  * IndexWriter doesn't accept per-doc Analyzer anymore

Closes #9524
2015-02-02 13:37:45 -05:00
Christoph Büscher 44193e7ba5 Aggregations: Add 'offset' option to histogram aggregation
Histogram aggregation supports an 'offset' option to move bucket boundaries.
In a histogram with buckets of size X these can be moved from 0, X, 2X, 3X,...
by an offset value of Y to Y, X+Y, 2X+Y, 3X+Y... by using the 'offset' option.
The previous 'pre_offset' and 'post_offset' options are removed in favour of
the simplified 'offset' option.

Closes #9417
Closes #9505
2015-02-02 18:23:01 +01:00
Alexander Reelsen a55476bf70 Tests: Ensure no use of potentially resolving internal ips 2015-02-02 09:45:42 +01:00
Boaz Leskes 79c8621a47 Test: add trace logging to testNodeFailuresAreProcessedOnce 2015-02-02 09:32:53 +01:00
Alexander Reelsen 59f8c0951a Netty Transport: Add profiles to transport infos
Until now, there was no possibility to expose infos about configured
transport profiles. This commit adds the ability to expose those
information in the TransportInfo class.

The channel was well as the netty pipeline handler now also contain
the profile they were configured for, as this information cannot be
extracted elsewhere.

In addition, each profile now can set its own publish host and port,
which might be needed in case of portforwarding or using docker.

Closes #9134
2015-02-02 08:17:55 +01:00
Martijn van Groningen 3ce05b6919 inner hits: Fix bug that resolves parent docs properly as inner hit when inner hit is defined on has_parent query. 2015-02-01 22:29:21 +01:00
Lee Hinman 9557625ae7 Disallow method pointer expressions in Groovy scripting 2015-01-30 15:55:19 -07:00
Lee Hinman 9fe84062a1 Add `beforeIndexAddedToCluster` callback
This callback is executed only once, on the master node during an
index's creation. An exception thrown during this listener will cancel
the index creation.

This also adds checks in `IndicesClusterStateService` for the
indexService being null as well as if the `indicesService.createIndex`
throws an exception on data nodes after an index has already been
created.
2015-01-30 15:25:58 -07:00
Adrien Grand b2010f788d [TESTS] IndicesQueryCacheTests: Ensure that shards are searchable before starting to query them. 2015-01-30 23:22:27 +01:00
Boaz Leskes eabc3cde98 Recovery: update access time of ongoing recoveries
#8720 introduced a timeout mechanism for ongoing recoveries, based on a last access time variable. In the many iterations on that PR the update of the access time was lost. This adds it back, including a test that should have been there in the first place.

Closes #9506
2015-01-30 21:06:28 +01:00
Adrien Grand 00d54fabb2 Search: Remove query-cache serialization optimization.
The query-cache has an optimization to not deserialize the bytes at the shard
level. However this is a bit fragile since it assumes that serialized streams
can be concatenanted (which is not the case with shared strings) and also does
not update the QueryResult object that is held by the SearchContext. So you
need to make sure to use the right one.

With this change, the query cache just deserializes bytes into the QueryResult
object from the context.

Close #9500
2015-01-30 20:02:18 +01:00
Simon Willnauer 380fcd1d02 Reset MergePolicProvider settings only if the value actually changed
Due to some unreleased refactorings we lost the persitence of
a perviously set values in MergePolicyProvider. This commit adds this
back and adds a simple unittest.

Closes #8890
2015-01-30 13:24:08 +01:00
Ryan Ernst 1ebc95ee28 Tests: Add type-unrestricted version of field mapper getter to SearchContext.
This fixes an NPE when using TestSearchContext in SignificanceHeuristicTests.
2015-01-29 13:42:07 -08:00
Ryan Ernst 4e0e5e7328 Aggs: Remove limitation on field access within aggs to the types
provided in the search

Currently, doing a field lookup within a terms agg will restrict the
fields available to those within the types passed into the search
request.  However, when doing sub aggs within a children agg, the
fields available should not be restricted to those of the search.

This change makes the field lookup use the index level mapper service.
2015-01-29 10:49:38 -08:00
Simon Willnauer c0fa60eb26 Remove HandlesStreamInput/Output
The optimization we do in the HandlesStreamInput / Output
adds a lot of complexity with a rather unknown benefit. It tries
to compress commonly used strings and write ids instead. This
should rather be done on a lower level if at all necessary for
the small message we send over the network.
2015-01-29 17:43:32 +01:00
Simon Willnauer 1d77c3af82 Fix compilation 2015-01-29 17:41:53 +01:00
Simon Willnauer 03f1fcc85e [ENGINE] Remove dirty flag and force boolean for refresh
Today we have a dirty flag indicating that a refresh must
be executed. We also allow users to bypass this by setting
a force=true boolean on the refresh request / command. All
these flags are unneeded since the SearcherManager has all
the information to do the right thing if it's dirty or not.
2015-01-29 17:30:00 +01:00
Britta Weber 0a07ce8916 core: disable auto gen id optimization
This pr removes the optimization for auto generated ids.
Previously, when ids were auto generated by elasticsearch then there was no
check to see if a document with same id already existed and instead the new
document was only appended. However, due to lucene improvements this
optimization does not add much value. In addition, under rare circumstances it might
cause duplicate documents:

When an indexing request is retried (due to connect lost, node closed etc),
then a flag 'canHaveDuplicates' is set to true for the indexing request
that is send a second time. This was to make sure that even
when an indexing request for a document with autogenerated id comes in
we do not have to update unless this flag is set and instead only append.

However, it might happen that for a retry or for the replication the
indexing request that has the canHaveDuplicates set to true (the retried request) arrives
at the destination before the original request that does have it set false.
In this case both request add a document and we have a duplicated a document.
This commit adds a workaround: remove the optimization for auto
generated ids and always update the document.
The asumtion is that this will not slow down indexing more than 10 percent,
see: http://benchmarks.elasticsearch.org/

closes #8788
closes #9468
2015-01-29 16:26:04 +01:00
Lee Hinman 86e52c30a1 Make `script.groovy.sandbox.method_blacklist_patch` truly append-only
Additionally, this setting can be specified in elasticsearch.yml if
desired, to pre-populate the list of methods to be added to the default
blacklist.

When making a change to this setting dynamically, the entire blacklist
is logged as well.
2015-01-28 17:09:27 -07:00
Ryan Ernst afcedb94ed Mappings: Remove `index_analyzer` setting to simplify analyzer logic
The `analyzer` setting is now the base setting, and `search_analyzer`
is simply an override of the search time analyzer.  When setting
`search_analyzer`, `analyzer` must be set.

closes #9371
2015-01-28 13:43:15 -08:00
Lee Hinman c610524392 Make groovy sandbox method blacklist dynamically additive
Using the `script.groovy.sandbox.method_blacklist_patch` setting, the
blacklist can be dynamically *added* to by specifying a comma-separated
list of methods (for example, "toString,size" would add .toString and
.size to the blacklist).

When the `script.groovy.sandbox.method_blacklist_patch` setting is
changed, the script cache is cleared to force new scripts to be
recompiled. Additionally the on-disk cache is cleared so that scripts in
the `config/scripts` directory are re-compiled as well.

This also fixes an issue where script engines were injected more than
once, which can cause multiple instances of the script engine per node.
2015-01-28 12:26:09 -07:00
Zachary Tong a4eb1d5505 Aggregations: Add standard deviation bounds to extended_stats
Extended_stats now displays the upper and lower bounds on standard deviations (e.g. avg +/- std).
Default is to show 2 std above/below, but can be changed using the `sigma` parameter.
Accepts non-negative doubles

Closes #9356
2015-01-28 11:47:20 -05:00
Nicholas Knize 9622f78fe6 Revert "[GEO] Update GeoPolygonFilter to handle ambiguous polygons"
This reverts commit 06667c6aa8 which introduces an undesireable dependency on JTS.
2015-01-28 08:03:26 -06:00
Boaz Leskes 1695f76f68 Test: testOldIndexes should disable merging
It verifies some segments need to be upgraded, but if they are merged away, there are upgraded implicitly
2015-01-28 11:34:58 +01:00
Boaz Leskes 22a576d5ba Recovery: flush immediately after a remote recovery finishes (unless there are ongoing ones)
To properly replicate, we currently stop flushing during recovery so we can repay the translog once copying files are done. Once recovery is done, the translog will be flushed by a background thread that, by default, kicks in every 5s. In case of a recovery failure and a quick re-assignment of a new shard copy, we may fail to flush before starting a new recovery, causing it to deal with potentially even longer translog. This commit makes sure we flush immediately when the ongoing recovery count goes to 0.

I also added a simple recovery benchmark.

Closes #9439
2015-01-28 09:14:23 +01:00
Igor Motov 13ef7d73b9 Snapshot/Restore: better handling of index deletion during snapshot
If an index is deleted during initial state of the snapshot operation, the entire snapshot can fail with NPE. This commit improves handling of this situation and allows snapshot to continue if partial snapshots are allowed.

Closes #9024
2015-01-27 21:06:29 -05:00
Boaz Leskes 3512860956 Test: always use replicas in testClusterInfoServiceInformationClearOnError
It assume the local node always has a shard
2015-01-28 00:23:03 +01:00
Nicholas Knize 06667c6aa8 [GEO] Update GeoPolygonFilter to handle ambiguous polygons
PR #8672 addresses ambiguous polygons - those that either cross the dateline or span the map - by complying with the OGC standard right-hand rule. Since ```GeoPolygonFilter``` is self contained logic, the fix in #8672 did not address the issue for the ```GeoPolygonFilter```. This was identified in issue #5968

This fixes the ambiguous polygon issue in ```GeoPolygonFilter``` by moving the dateline crossing code from ```ShapeBuilder``` to ```GeoUtils``` and reusing the logic inside the ```pointInPolygon``` method.  Unit tests are added to ensure support for coordinates specified in either standard lat/lon or great-circle coordinate systems.

closes #5968
closes #9304
2015-01-27 15:45:05 -06:00
Boaz Leskes 9ac6d78308 Internal: ClusterInfoService should wipe local cache upon unknown exceptions
The InternalClusterInfoService reaches out to the nodes to get information about their disk usage and shard store size. Upon a node level error we currently remove the node info from the local cache. We should also clear the cache when we run into an error on the action level (excluding any info from all nodes).

 This also adds settings for the timeout used when waiting for nodes.

Closes #9449
2015-01-27 22:38:08 +01:00
simaov f3e1a66133 #9444 throw StrictDynamicMappingException exception if dynamic is 'strict' and undeclared field value is NULL, test for this
Fixes #9445
2015-01-27 18:14:56 +00:00
Lee Hinman 39c064ce8b [TEST] remove AwaitsFix from DeleteByQuery test 2015-01-27 10:15:44 -07:00
Ryan Ernst cff0ec3972 Mappings: Remove type level default analyzers
closes #8874
2015-01-27 08:30:51 -08:00
Colin Goodheart-Smithe 6f894b1d2c [TEST] Fix HistogramTests
Fixed histogram tests for value scripts as it was picking the wrong buckets form the bucket list following the removal of the getBucketByKey method
2015-01-27 12:10:38 +00:00
Martijn van Groningen 7e6e9dbb96 Aggs: nested agg needs to reset root doc between segments.
Closes #9437
Closes #9436
2015-01-27 12:53:47 +01:00
Colin Goodheart-Smithe 285ef0f06d Aggregations: Clean up response API for Aggregations
This change makes the response API object for Histogram Aggregations the same for all types of Histogram, and does the same for all types of Ranges.
The change removes getBucketByKey() from all aggregations except filters and terms. It also reduces the methods on the Bucket class to just getKey() and getKeyAsString().
The getKey() method returns Object and the actual Type is returns will be appropriate for the type of aggregation being run. e.g. date_histogram will return a DateTime for this method and Histogram will return a Number.
2015-01-27 10:53:44 +00:00
Lee Hinman 0143d835d4 [TEST] Add `ensureGreen` to indices created in TopHitsTests 2015-01-26 18:45:04 -07:00
Lee Hinman 8fc58dc00a [TEST] Add `ensureGreen` where needed in NestedTests 2015-01-26 18:26:04 -07:00
Lee Hinman 92b218ba51 [TEST] Mute DeleteByQueryTests.testDeleteAllOneIndex
See:
https://github.com/elasticsearch/elasticsearch/issues/9421
2015-01-26 18:01:08 -07:00
Martijn van Groningen a645994086 Aggs: fix handling of the same child doc id being processed multiple times in the `reverse_nested` aggregation.
Closes #9263
Closes #9345
2015-01-26 18:36:35 +01:00
Ryan Ernst 385c43c141 Mappings: Remove _analyzer
closes #9279
2015-01-26 09:14:17 -08:00
Lee Hinman 537769c225 Relax restrictions on filesystem size reporting
Apparently some filesystems such as ZFS and occasionally NTFS can report
filesystem usages that are negative, or above the maximum total size of
the filesystem. This relaxes the constraints on `DiskUsage` so that an
exception is not thrown.

If 0 is passed as the totalBytes, `.getFreeDiskAsPercentage()` will
always return 100.0% free (to ensure the disk threshold decider fails
open)

Fixes #9249
Relates to #9260
2015-01-26 09:46:21 -07:00
Martijn van Groningen 7ca2ef9b93 Nested aggregator: Fix handling of multiple buckets being emitted for the same parent doc id.
This bug was introduced by #8454 which allowed the childFilter to only be consumed once. By adding the child docid buffering multiple buckets can now be emitted by the same doc id. This child docid buffering only happens in the scope of the current root document, so the amount of child doc ids buffered is small.

Closes #9317
Closes #9346
2015-01-26 17:41:25 +01:00
Britta Weber f8294352f7 [TEST] mute test for now becasue we have an issue for it 2015-01-26 17:30:43 +01:00
Martijn van Groningen f9c0e0d4c7 aggs: The `nested` aggregator's parent filter is n't resolved properly in the case the nested agg gets created on the fly for buckets that are constructed during query execution.
The fix is the move the parent filter resolving from the nextReader(...) method to the collect(...) method, because only then any parent nested filter's parent filter is then properly instantiated.

Closes #9280
Closes #9335
2015-01-26 12:17:52 +01:00
Britta Weber c3f1982f21 [TEST] check that primaries succeeded
We want to check if at least the primaries succeeded if we do not
wait for green and not if all succeeded if we wait for green.
That was a misconception in c617af37e8
2015-01-26 11:14:38 +01:00
Boaz Leskes 974fafb2da Test: add logging to SearchWithRandomExceptionsTests 2015-01-26 09:59:01 +01:00
Ryan Ernst dfc2c9f3a1 Tests: Tweaking static bwc tests to improve stability 2015-01-23 13:59:42 -08:00
Ryan Ernst 54d01c48cb Tests: Add memory info to static bwc index tests. 2015-01-23 13:20:23 -08:00
Britta Weber c617af37e8 [TESTS] ensureGreen, else reported successful shards will be lower than expected 2015-01-23 17:12:33 +01:00
Britta Weber b6c74fb21c [TESTS] Mute test until issue is resolved 2015-01-23 16:41:56 +01:00
Britta Weber 35e507ad54 [TEST] Check for total shards >= number of shards instead of ==
Requests are sent to two shard copies in case a shard is relocating.
This will show up in the the _shards header. Therefore we must check
with greaterThanOrEqualTo(..).
2015-01-23 15:40:30 +01:00
Christoph Büscher eeb96db76b Rest: Adding support of multi-index query parameters for _cluster/state
Adding missing support for the multi-index query parameters 'ignore_unavailable',
'allow_no_indices' and 'expand_wildcards' to '_cluster/state' API. These
parameters are supposed to be supported for APIs that work across multiple indices.
So far overwriting the default settings per REST call was not possible which is
fixed here.

Closes #5229
Closes #9295
2015-01-22 16:47:14 +01:00
Ryan Ernst 314b62c8ae Tests: Rename tests with the same name
These two tests are confusing because they have the same class name in
different packages.  This results in accidentally looking at the wrong
file when trying to open the test by class name. They are also
not "simple"..
2015-01-20 15:41:53 -08:00
Igor Motov c0da353ef5 Snapshot/Restore: add support for changing index settings during restore process
Closes #7887
2015-01-20 15:49:47 -05:00
Ryan Ernst 81621840b8 Tests: Block replica check for static index bwc tests until all pending
tasks are complete

Blocking once replicas are set to 0 here should remove the chance of a
race condition while the replicas are being removed.
2015-01-20 11:08:42 -08:00
Ryan Ernst a7a726700e Tests: Increase timeout for waiting on replicas for static index tests 2015-01-20 09:54:03 -08:00
Britta Weber 23c358d2ef [TEST] mute test, we have issue #9270 for it 2015-01-20 15:01:05 +01:00
David Pilato fb10346953 [Mapper] Add `ignore_missing` option to `timestamp`
Related to #9049.

By default, the default value for `timestamp` is `now` which means the date the document was processed by the indexing chain.

You can now reject documents which not provide a `timestamp` value by setting `ignore_missing` to false (default to `true`):

```js
{
    "tweet" : {
        "_timestamp" : {
            "enabled" : true,
            "ignore_missing" : false
        }
    }
}
```

When you update the cluster to 1.5 or master, this index created with 1.4 we automatically migrate an index created with 1.4 to the 1.5 syntax.

Let say you have defined this in elasticsearch 1.4.x:

```js
DELETE test
PUT test
{
  "settings": {
    "number_of_shards": 1,
    "number_of_replicas": 0
  }
}
PUT test/type/_mapping
{
  "type" : {
      "_timestamp" : {
          "enabled" : true,
          "default" : null
      }
  }
}
```

After migration, the mapping become:

```js
{
   "test": {
      "mappings": {
         "type": {
            "_timestamp": {
               "enabled": true,
               "store": false,
               "ignore_missing": false
            },
            "properties": {}
         }
      }
   }
}
```

Closes #8882.
2015-01-20 13:20:05 +01:00
Igor Motov fcb0186d2e Tests: Make sure snapshots created with old version of elasticsearch can be restored
Closes #8968
2015-01-19 20:28:33 -05:00
Britta Weber e037250ce9 [TEST] fix scores in ExplainableScriptTests 2015-01-19 20:00:39 +01:00
javanna 6c2139c186 Tribe node: remove closed indices from cluster state
At startup the tribe node ignores closed indices, but if you closed an index that was part of the tribe node cluster state, its state change was not currently handled. A NullPointerException could be seen in the logs instead as the routing table for the closed index was null. As a result, the index stayed in the tribe node cluster state in open state, although that didn't reflect reality. Also, subsequent cluster state updates happening in the tribe node kept failing, affecting updates related to any other index. The only way to recover from this was to restart the tribe node every time an index is closed on any tribe.

This commit properly handles index state changes, making sure that when an index gets closed it gets removed from the tribe node cluster state. Note that it makes little sense to keep the closed index around in the tribe node, as from the tribe node you can't do anything with it. The tribe node simply doesn't see any closed index, it's the same as if they didn't exist.

Closes #6411
Closes #9334
2015-01-19 16:27:52 +01:00
Lee Hinman 283a467e20 Pass through all exceptions in IndicesLifecycleListeners
This allows a plugin or user that registers a listener to be able to
stop actions like creating an index or starting a shard by throwing an
exception. Previously all exceptions were logged without being rethrown.
2015-01-19 15:10:54 +01:00
Britta Weber 366ddfc89a scripts: add explainable script again
explainable scripts were removed in #7245 but they were used.
This commit adds them again.

closes #8561
2015-01-19 13:44:47 +01:00
Britta Weber 7230e605fe function_score: use query and filter together
Before, if filter and query was defined for function_score, then the
filter was silently ignored. Now, if both is defined then function score
query wraps this in a filtered_query.

closes #8638
closes #8675
2015-01-19 12:12:38 +01:00
Britta Weber 75e1500e68 cleanup: Remove `gateway.type: local`
This property was removed in 45408844e7 and 1247774ff1

closes #9128
2015-01-19 11:53:27 +01:00
Martijn van Groningen fcbba930a4 Children aggregation: The children aggs' post collection translates the buckets on the parent level to the child level and because of that it needs to invoke the post collection of its nested aggs.
Closes #9271
2015-01-19 11:42:52 +01:00
sweetest eaa1674d6d Introduce index option named 'index.percolator.map_unmapped_fields_as_string', that handles unmapped fields in percolator queries as type string.
Closes #9053
Closes #9054
2015-01-19 09:51:10 +01:00
Igor Motov a4c92eb67e Snapshot/Restore: add validation of restored persistent settings
Closes #8830
2015-01-17 19:39:35 -05:00
Nicholas Knize e69b5c3424 [GEO] NPE parsing GeoJSON polygon with single LinearRing
ShapeBuilder threw a NPE when a polygon coordinate array consisted of a single LinearRing. This PR fixes the error handling to throw a more useful ElasticsearchParseException to provide the user with better insight into the problem.
2015-01-16 13:08:29 -06:00
Michael McCandless 6ab21e5b1b test must start with auto_throttle enabled 2015-01-16 13:50:17 -05:00
Ryan Ernst 795c347db3 Upgrade: Fix version check in bytes to upgrade that spans major versions
The previous check did not account for major version, so upgrading to
5.1 caused 4.1 (from 0.90.0.Beta1) to look the same as current master.
2015-01-16 10:41:02 -08:00
Michael McCandless b9358ccca8 Core: switch to auto IO throttle for merges
This adds a new boolean (index.merge.scheduler.auto_throttle) dynamic
setting, default true (matching Lucene), to adaptively set the IO rate
limit for merges over time.

This is more flexible than the previous fixed rate throttling because
it responds depending on the incoming merge rate, so search-heavy
applications that are not doing much indexing will see merges heavily
throttled while indexing-heavy cases will lighten the throttle so
merges can keep up within incoming indexing.

The fixed rate throttling is still available as a fallback if things
go horribly wrong.

Closes #9243

Closes #9133
2015-01-16 13:00:08 -05:00
Adrien Grand f6d5b3932a [TESTS] Mute OldIndexBackwardsCompatibilityTests. 2015-01-16 12:15:59 +01:00
Adrien Grand 1fc24a8837 Upgrade to lucene-5.1.0-snapshot-1652032.
This new Lucene snapshot does not have out-of-order scoring anymore.

Close #9318
2015-01-16 09:37:29 +01:00
Ryan Ernst 1ee6ff0ea5 Tests: Add final missing static bwc index for 1.2.0
See #9297
2015-01-15 23:12:41 -08:00
Ryan Ernst 979f99af7f Remove irrelevant bwc comment 2015-01-15 23:02:02 -08:00
Robert Muir 365ec15d2b Backcompat: Fix backcompat for 0.90.0.Beta1 indexes 2015-01-15 22:54:26 -08:00
Ryan Ernst 8e864d037e Tests: Add tests for missing static indexes, and ensure newly added
versions will force indexes to be added.
2015-01-15 22:52:41 -08:00
Shay Banon 716cc5fb05 [TEST] Mmm, still wrap wrappers still its needed post closing dir
previous push was partial by mistake, we still need the wrapped dirs around after being closed for the test infra, for now, explicitly clear it in the leak test (which is still bad apple)
2015-01-15 17:57:47 -07:00
Shay Banon 683050c6ed [TEST] Mock Directory didn't clean wrapped dirs
I ran the bad apple test for index memory leaks and still saw leaks, it seems like we don't properly clean the dirs from the static mock test dir wrapper
2015-01-15 17:38:10 -07:00
Michael McCandless 107099affa put back fixed throttling, but off by default 2015-01-14 05:35:09 -05:00
Ryan Ernst f241125302 Internal: Change snapshot state for unreleased versions and add
validation tests for constants

Currently the snapshot flag for Version constants is only set to true
for CURRENT.  However, this means that the snapshot state changes from
branch to branch.  Instead, snapshot should be "is this version
released?".  This change also adds a validation test checking that
ID -> constant and vice versa are correct, and fixes one bug found there
(for an unreleased version).
2015-01-13 12:42:48 -08:00
Adrien Grand a56520d26d Internal: clean up memory reuse a bit.
- don't allow for soft references anymore in the recycler
 - remove some abusive thread locals
 - don't recycle independently float/double and int/long pages, they are the
   same and just interpret bits differently.

Close #9272
2015-01-13 18:08:12 +01:00
Adrien Grand b8be8e432e Query cache: Make the query cache usable on time-based data.
The query cache has a mechanism that disables it automatically when
SearchContext.nowInMillis() is used. One issue with that is that the date math
parser always evaluates the current timestamp when parsing a date, even if it
is not needed. As a consequence, whenever you use a date expression in your
queries, the query cache would not be used.

Close #9225
2015-01-13 17:23:59 +01:00
Adrien Grand d583080f20 Remove unused DoubleObjectPagedHashMap. 2015-01-13 10:49:32 +01:00
David Pilato be1610ba63 [Mapper] Using default=null for _timestamp field creates a index loss on restart
Step to reproduce:

* Create new index and type.

```
DELETE new_index
PUT new_index
 {
    "mappings": {
    	"power": {
	        "_timestamp" : {
	            "enabled" : true,
	            "default": null
	        }
	    }
    }
}
```

* Add a document

```
PUT new_index/power/1
{
    "foo": "bar"
}
```

* Restart cluster ... and **index is missing**...

```
GET new_index
```

Gives IndexMissingException

Closes #9223.

(cherry picked from commit e654a2c)
(cherry picked from commit aef3bc2)
2015-01-13 09:49:26 +01:00
Ryan Ernst 69f74d714f Tests: Fix failure introduced in #8967 2015-01-12 09:27:27 -08:00
Ryan Ernst 6f214d791f Tests: Fix test failure introduced in #8967 2015-01-12 08:42:59 -08:00
Ryan Ernst 7d5a15e461 Mapping: serialize doc values settings for _timestamp
This change fixes _timestamp's serialization method to write out
`doc_values` and `doc_values_format`, which could already be set,
but would not be written out.

closes #8893
closes #8967
2015-01-12 08:26:59 -08:00
Lee Hinman a3972f03c6 Pass index settings where appropriate in IndicesLifecycle
This allows plugins to be able to perform some needed setup before and
after an index/shard is in use.
2015-01-12 15:04:37 +01:00
Lee Hinman 6b24921bd4 [TEST] Re-add rebalance disable setting in RecoveryFromGatewayTests 2015-01-12 14:21:31 +01:00
Sebastian Utz 358bb9bd75 fixup! fixup! add support for registering custom circuit breaker 2015-01-12 10:32:14 +01:00
Martijn van Groningen a88dd36df4 Test: Only run the test that verifies the `pending` field in the `_shards` header if the test cluster has two are more data nodes. 2015-01-12 10:29:23 +01:00
Michael McCandless 1aad275c55 expose current CMS throttle in merge stats; fix tests, docs; also log per-merge stop/throttle/rate 2015-01-11 05:52:43 -05:00
Michael McCandless 31e6acf3f2 first cut 2015-01-10 16:38:56 -05:00
Boaz Leskes 102e7adfad Recovery: be more resilient to partial network partitions
This commits adds a test that simulate disconnecting nodes and dropping requests during the various stages of recovery and solves all the issues that were raised by it. In short:

1) On going recoveries will be scheduled for retry upon network disconnect. The default retry period is 5s (cross node connections are checked every 10s by default).
2) Sometimes the disconnect happens after the target engine has started (but the shard is still in recovery). For simplicity, I opted to restart the recovery from scratch (where little to no files will be copied again, because there were just synced).
3) To protected against dropped requests, a Recovery Monitor was added that fails a recovery if no progress has been made in the last 30m (by default), which is equivalent to the long time outs we use in recovery requests.
4) When a shard fails on a node, we try to assign it to another node. If no such node is available, the shard will remain unassigned, causing the target node to clean any in memory state for it (files on disk remain). At the moment the shard will remain unassigned until another cluster state change happens, which will re-assigned it to the node in question but if no such change happens the shard will remain stuck at unassigned. The commits adds an extra delayed reroute in such cases to make sure the shard will be reassinged
5) Moved all recovery related settings to the RecoverySettings.

Closes #8720
2015-01-10 15:19:30 +01:00
Ryan Ernst 4cda543637 Tests: Add logic to handle static index upgrade case where index is
already on latest version.

See #9207
2015-01-09 12:40:44 -08:00
Robert Muir d226a973f7 core: upgrade to lucene 5 r1650327.
refactor _version docvalues migration to be more efficient.

closes #9206
2015-01-09 12:12:31 -05:00
Colin Goodheart-Smithe 91e00c6c8e Aggregations: Numeric metric aggregations are now formattable
You can now specify `format` in the request definition for most numeric metric aggregations. The exceptions are Percentile_Ranks, Cardinality and Value_Count as the response type of these can be different from the field type so the formatter won't work.

Closes #6812
2015-01-09 16:10:58 +00:00
David Pilato 6d58db8868 Mapping With a `null` Default Timestamp Causes NullPointerException on Merge
I have a field with a `null` [default `_timestamp` value](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/mapping-timestamp-field.html#mapping-timestamp-field-default) and when I try to update the mapping I get a server error caused by a `NullPointerException`

```
[2015-01-08 17:28:56,040][DEBUG][action.admin.indices.mapping.put] [...] failed to put mappings on indices [[feed_170_v1, feed_204_v1, feed_229_v1, feed_232_v1, feed_239_v1, feed_248_v1, feed_268_v1, feed_256_v1, feed_272_v1, feed_159_v1, feed_255_v1, feed_164_v1, feed_259_v1, feed_266_v1, feed_188_v1, feed_240_v1, feed_233_v1, feed_13_v1, feed_184_v1, feed_261_v1, feed_267_v1, feed_271_v1, feed_257_v1, feed_172_v1, feed_238_v1, feed_254_v1, feed_223_v1, feed_274_v1, feed_203_v1, feed_269_v1, feed_262_v1, feed_205_v1, feed_168_v1, feed_219_v1, feed_253_v1, feed_251_v1, feed_173_v1, feed_252_v1, feed_210_v1, feed_216_v1, feed_218_v1, feed_118_v1, feed_273_v1, feed_227_v1, feed_166_v1, feed_213_v1, feed_226_v1]], type [history]
java.lang.NullPointerException
        at org.elasticsearch.index.mapper.internal.TimestampFieldMapper.merge(TimestampFieldMapper.java:287)
        at org.elasticsearch.index.mapper.object.ObjectMapper.merge(ObjectMapper.java:936)
        at org.elasticsearch.index.mapper.DocumentMapper.merge(DocumentMapper.java:693)
        at org.elasticsearch.cluster.metadata.MetaDataMappingService$4.execute(MetaDataMappingService.java:508)
        at org.elasticsearch.cluster.service.InternalClusterService$UpdateTask.run(InternalClusterService.java:329)
        at org.elasticsearch.common.util.concurrent.PrioritizedEsThreadPoolExecutor$TieBreakingPrioritizedRunnable.run(PrioritizedEsThreadPoolExecutor.java:153)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
        at java.lang.Thread.run(Thread.java:745)
```

https://github.com/elasticsearch/elasticsearch/blob/v1.4.2/src/main/java/org/elasticsearch/index/mapper/internal/TimestampFieldMapper.java#L286

Looks like the existence of default timestamp is not checked before use. The next line also has the same issue -- uses of default timestamp without checked to see if it's not null.

To reproduce:

```
$ curl -XPUT localhost:9200/twitter2

$ curl -XPUT localhost:9200/twitter2/tweet/_mapping -d '{
     "tweet" : {
         "_timestamp" : {
             "enabled" : true,
             "default" : null
         }
     }
}'

$ curl -XPUT localhost:9200/twitter2/tweet/_mapping -d '{
     "tweet" : {
         "_timestamp" : {
             "enabled" : true,
             "default" : null
         },
         "properties": {
             "user": {"type": "string"}
         }
     }
}'
```

Closes #9204.

(cherry picked from commit 62c6d63)
2015-01-08 21:33:17 +01:00
Ryan Ernst 7f9ffea97c Tests: Add upgrade step to static bwc tests 2015-01-08 11:53:48 -08:00
Ryan Ernst 060f963a8e Mappings: Remove allow_type_wrapper setting
Before Elasticsearch 1.0, the type was allowed to be passed as the root
element when uploading a document.  However, this was ambiguous if the
mappings also contained a field with the same name as the type.  The
behavior was changed in 1.0 to not allow this, but a setting was added
for backwards compatibility.  This change removes the setting for 2.0.
2015-01-08 09:13:40 -08:00
Martijn van Groningen ca4f27f40e Core: Added `_shards` header to all write responses.
The header indicates to how many shard copies (primary and replicas shards) a write was supposed to go to, to how many
shard copies to write succeeded and potentially captures shard failures if writing into a replica shard fails.

For async writes it also includes the number of shards a write is still pending.

Closes #7994
2015-01-08 18:10:08 +01:00
Simon Willnauer 959e3ca9da [CORE] Fold engine into IndexShard
This commit removes most of the Engine abstractions and removes
Engine exposure via dependency injection. It also removes the Holder
abstraction and makes the engine itself start at constrcution time.
It removes the start method from the engine entire which means no engine
instances exists until it's started. There is also no way to stop the
engine to restart, it needs to be an entire new Engine
2015-01-08 17:48:27 +01:00
Martijn van Groningen dedaf9387e Core: Also check if indices resolved via aliases resolution aren't closed and deal with this according to IndicesOptions.
Closes #9057
2015-01-08 16:45:34 +01:00
Simon Willnauer 78fc7c3f01 [TEST] Ensure shard lock is acquired before we try the timeout version 2015-01-08 15:37:31 +01:00
Boaz Leskes ad66d25fa2 Test: trace logging for testDeleteSafe 2015-01-07 23:16:19 +01:00
Simon Willnauer 77493762e2 [TEST] Add back MockIndexEngine
This test class was lost accidentially in a8fa650
2015-01-07 16:38:21 +01:00
Martijn van Groningen 20f7be378b Removed parent parameter from update request, because it is just sets the routing.
The routing option should be used instead. The parent a child document points to can't be updated.

Closes #4538
2015-01-07 10:26:20 +01:00
Martijn van Groningen 687be70736 Made sure that named filters and queries defined in a wrapped query and filter are not lost.
Closes #6871
2015-01-07 09:10:16 +01:00
Martijn van Groningen c94d056454 Fixed a bug that was caused by specifying routing on a multi percolate request causing an ArrayIndexOutOfBoundsException.
The multi percolate shard responses are collected in an atomic array which uses the shard id is used as index, but the number of shards the multi percolate request was meant to go to was used as size of this array instead the total number of shards an index has. This caused the exception when routing was used.

Closes #6214
2015-01-07 08:49:25 +01:00
Simon Willnauer 7ec8973fbc [CORE] Delete shard content under lock
Once we delete the the index on a node we are closing all resources
and subsequently need to delete all shards contents from disk. Yet
this happens today under a lock (the shard lock) that needs to be
acquried in order to execute any operation on the shards data
path. We try to delete all the index meta-data once we acquired
all the shard lock but this operation can run into a timeout which causes
the index to remain on disk. Further, all shard data will be left on
disk if the timeout is reached.

This commit removes all the shards data just before the shard lock
is release as the last operation on a shard that belongs to a deleted
index.
2015-01-06 21:53:28 +01:00
Ryan Ernst f7f99b8dbf Stats: Added verbose option to segments api, with full ram tree as first
additional element per segment.

This commit adds a verbose flag to the _segments api.  Currently the
only additional information returned when set to true is the full
ram tree from lucene for each segment.
2015-01-06 10:04:52 -08:00
Simon Willnauer 236e2491b4 [ALLOCATION] Remove primary balance factor
The `cluster.routing.allocation.balance.primary` setting has caused
a lot of confusion in the past while it has very little benefit form a
shard allocatioon point of view. Users tend to modify this value to
evently distribute primaries across the nodes which is dangerous since
a prmiary flag on it's own can trigger relocations. The primary flag for a shard
is should not have any impact on cluster performance unless the high level feature
suffereing from primary hotspots is buggy. Yet, this setting was intended to be a
tie-breaker which is not necessary anymore since the algorithm is deterministic.

This commit removes this setting entriely.
2015-01-06 16:43:39 +01:00
Simon Willnauer 4900f52619 [ALLOCATION] Weight deltas must be absolute deltas
In some situations the shard balanceing weight delta becomes negative. Yet,
a negative delta is always treated as `well balanced` which is wrong. I wasn't
able to reproduce the issue in any way other than useing the real world data
from issue #9023. This commit adds a fix for absolute deltas as well as a base
test class that allows to build tests or simulations from the cat API output.

Closes #9023
2015-01-06 15:48:44 +01:00
Martijn van Groningen ca68136628 Made the `nested`, `reverse_nested` and `children` aggs ignore unmapped nested fields or unmapped child / parent types.
Closes #8760
2015-01-06 12:14:15 +01:00
Adrien Grand 4cb23a0520 Search: Fix paging on strings sorted in ascending order.
For the comparator to work correctly, we need to give it the same value in
`setTopValue` as the value that it gave back in `value`.

Close #9136
2015-01-06 11:48:05 +01:00
Adrien Grand 999bec1243 Make DistributorDirectory not call fsync on sub directories and missing files.
Related to #9145
2015-01-06 11:15:42 +01:00
Adrien Grand 90f98579a2 Upgrade to Lucene 5.0.0-snapshot-1649544.
A couple of changes that triggerred a refactoring in Elasticsearch:

 - LUCENE-6148: Accountable.getChildResources returns a collection instead of
   a list.

 - LUCENE-6121: CachingTokenFilter now propagates reset(), as a result
   SimpleQueryParser.newPossiblyAnalyzedQuery has been fixed to not reset both
   the underlying stream and the wrapper (otherwise lucene would barf because of
   a doubl reset).

 - LUCENE-6119: The auto-throttle issue changed a couple of method
   names/parameters. It also made
   `UpdateSettingsTests.testUpdateMergeMaxThreadCount` dead slow so I muted this
   test until we clea up merge throttling to use LUCENE-6119.

Close #9145
2015-01-06 09:24:18 +01:00
Alexander Reelsen 8626c18ad9 Settings: Ensure fields are overriden and not merged when using arrays
In the case you try to merge two settings, one being an array and one being
a field, together, the settings were merged instead of being overridden.

First config
my.value: 1

Second config
my.value: [ 2, 3 ]

If you execute

settingsBuilder().put(settings1).put(settings2).build()

now only values 2,3 will be in the final settings

Closes #8381
2015-01-06 09:13:10 +01:00
Robert Muir 9f6a6a832f fix TODO for master, we don't need to support this version here 2015-01-05 15:31:49 -05:00
Robert Muir 8f2f2c5663 Tests: add 0.20 index and fix test bugs in assertNewReplicasWork() 2015-01-05 15:30:18 -05:00
Britta Weber 9454593d6a [TEST] mute ExceptionRetryTests 2015-01-03 18:40:19 +01:00
Britta Weber f45e6ae3f9 [index] Prevent duplication of documents when retry indexing after fail
If bulk index request fails due to a disconnect, unavailable shard etc, the request is
retried once before actually failing. However, even in case of failure the documents
might already be indexed. For autogenerated ids the request must not add the
documents again and therfore canHaveDuplicates must be set to true.

closes #8788
2015-01-02 15:44:47 +01:00
Nicholas Knize b21024b5f9 [GEO] Throw helpful exception for Polygons with holes outside the shell
A recent situation occured where a MultiPolygon coordinate array was accidentally defined as a single polygon with multiple holes. Since the intent was a MultiPolygon, the holes of the unintended Polygon fell outside the outer shell.  This exposed a bug in the contains logic inside BasePolygonBuilder. An ArrayIndexOutOfBoundsException was being thrown instead of a more useful ElasticsearchParseException( "hole is not within polygon" ).  This pull request fixes the bug and adds additional unit tests for verifying proper MultiPolygon type parsing.

closes #9071
2015-01-02 08:14:07 -06:00
Simon Willnauer 93dddcdfd9 [TEST] Wait for green if index is closed and reopened
if we reopen an index and the majority of the replicas where
not created the reopen will fail sicne on master this runs with
local gatway all the time.
2015-01-02 14:58:18 +01:00
Simon Willnauer 3e37c89932 [INTERNAL] Remove OperationRouting abstraction
This commit removes the unneeded OperationRouting interface and flattens
the package structure inside cluster.routing
2015-01-02 12:17:35 +01:00
Adrien Grand 56974bf867 [TEST] Fix GroovyScriptTests failures. 2014-12-31 10:02:45 +01:00
Ryan Ernst 6304f68715 Scripting: Make _score in groovy scripts comparable
closes #8828
closes #9094
2014-12-30 16:38:44 -08:00
Nicholas Knize 0e24f34b0c [GEO] GIS envelope validation
ShapeBuilder expected coordinates for Envelope types in strict Top-Left, Bottom-Right order. Given that GeoJSON does not enforce coordinate order (as seen in #8672) clients could specify envelope bounds in any order and be compliant with the GeoJSON spec but not the ES ShapeBuilder logic. This change loosens the ShapeBuilder requirements on envelope coordinate order, reordering where necessary.

closes #2544
closes #9067
closes #9079
closes #9080
2014-12-30 11:54:07 -06:00
Lee Hinman 31652a8b3d Fix TransportNodesListShardStoreMetaData for custom data paths
Cleans up the testReusePeerRecovery test as well

The actual fix is in TransportNodesListShardStoreMetaData.java, which
needs to use `nodeEnv.shardDataPaths` instead of `nodeEnv.shardPaths`.

Due to the difficulty in tracking this down, I've added a lot of
additional logging. This also fixes a logging issue in GatewayAllocator
2014-12-30 17:50:38 +01:00
Simon Willnauer bc65afba8a [TEST] Wait for threads to finish / start before asserting 2014-12-30 15:45:28 +01:00
Lee Hinman a4e2230ebd Add index.data_path setting
This allows specifying the path an index will be at.

`index.data_path` is specified in the settings when creating an index,
and can not be dynamically changed.

An example request would look like:

POST /myindex
{
  "settings": {
    "number_of_shards": 2,
    "data_path": "/tmp/myindex"
  }
}

And would put data in /tmp/myindex/0/index/0 and /tmp/myindex/0/index/1

Since this can be used to write data to arbitrary locations on disk, it
requires enabling the `node.enable_custom_paths` setting in
elasticsearch.yml on all nodes.

Relates to #8976
2014-12-29 14:40:50 +01:00
Martijn van Groningen d8054ec299 inner_hits: Added another more compact syntax for inner hits.
Closes #8770
2014-12-24 17:41:35 +01:00
Adrien Grand cc71f7730a [TESTS] Make sure to wait for all shards to be allocated before running the test. 2014-12-24 11:18:40 +01:00
Martijn van Groningen a345e98575 Core: `ignore_unavailable` shouldn't ignore closed indices if a single index is specified in a search or broadcast request.
Closes #9047
Closes #7153
2014-12-24 10:46:03 +01:00
Adrien Grand 7678ab5264 Parent/child: Fix concurrency issues of the _parent field data.
`_parent` field data mistakenly shared some stateful data-structures across
threads.

Close #8396
2014-12-24 09:34:40 +01:00
Adrien Grand 24591b3c70 Search: parse terms filters on a single term as a term filter.
Running a terms filter on a single term is equivalent to loading a postings
list into a bit set and then returning the bit set instead of reading the
postings list on the fly.

Close #9014
2014-12-24 09:33:21 +01:00
Nicholas Knize 77a7ef28b3 [GEO] Add optional left/right parameter to GeoJSON
This feature adds an optional orientation parameter to the GeoJSON document and geo_shape mapping enabling users to explicitly define how they want Elasticsearch to interpret vertex ordering.  The default uses the right-hand rule (counterclockwise for outer ring, clockwise for inner ring) complying with OGC Simple Feature Access standards. The parameter can be explicitly specified for an entire index using the geo_shape mapping by adding "orientation":{"left"|"right"|"cw"|"ccw"|"clockwise"|"counterclockwise"} and/or overridden on each insert by adding the same parameter to the GeoJSON document.

closes #8764
2014-12-22 12:09:45 -06:00
Colin Goodheart-Smithe 391b5f3f5e Aggregations: Adds methods to get to/from as Strings for Range Aggs
Adds getToAsString and getFromAsString to Range interface and implements them for all range aggregations

Closes #9003
2014-12-22 09:56:25 +00:00
Nik Everett a95d75e074 Mappings: Reencode transformed result with same xcontent
When I originally wrote the transform feature I didn't think that the
XContentType of the reencoded source mattered.  It actually matters because
payloads for the completion suggester are stored and returned exactly
as encoded by this XContentType.

This revision changes the transform feature from always reencoding with smile
to always reencoding with the provided XContentType to support the completion
suggester.

Closes #8959
2014-12-22 10:11:25 +01:00
tlrx a4133ec4a3 Shutdown: Add support for Ctrl-Close event on Windows platforms to gracefully shutdown node
This commit adds the support for the Ctrl-Close event on Windows using native system calls. This way, it is possible to catch the Ctrl-Close event sent by a 'taskill /pid' command (or when the user closes the console window where elasticsearch.bat was started) and gracefully close the node. Before this commit, the node was simply killed on taskkill/window closing.
2014-12-22 09:36:29 +01:00
Boaz Leskes defecb3f80 Test: added some logging to NodeEnvironmentTests.testDeleteSafe 2014-12-20 00:27:37 +01:00
Boaz Leskes 4d699bd76c Internal: remove IndexCloseListener & Store.OnCloseListener
Closes #9009
2014-12-19 21:11:46 +01:00
Boaz Leskes c077683248 Test: ZenFaultDetectionTests.testNodesFaultDetectionConnectOnDisconnect should account for initial ping
There was a race condition in the test in the case where the nodes fault detection would manage to send and initial ping, followed by 2 attempts before the target service was disconnected.
2014-12-19 13:12:39 +01:00
Boaz Leskes cb0d462aa0 Test: fix racing condition in IndicesRequestTests
a request could be captured after action array was cleared.
2014-12-19 11:25:12 +01:00
Boaz Leskes 635ae29bf1 Recovery: cleaner interrupt handling during cancellation
RecoveryTarget initiates the recovery by sending a start recovery request to the source node and then waits for the recovery to complete. During recovery cancellation, we interrupt the thread so it will wake up and clean the recovery. Depending on timing, this can leave an unneeded interrupted thread status causing future IO commands to fail unneeded.

RecoverySource already had a handy utility called CancellableThreads. This extracts it to a top level class, and uses it in RecoveryTarget as well.

Closes #9000
2014-12-19 10:39:21 +01:00
Guillaume Hiron 8738583de6 FunctionScore: Fix 'avg' score mode to correctly implement weighted mean.
closes #8992
closes #9004
2014-12-18 16:36:39 -08:00
Boaz Leskes e6a190ec58 Test: AutoFilterCachingPolicy.HISTORY_SIZE should be large enough to accommodate other param 2014-12-18 21:00:47 +01:00
Adrien Grand 55d8bfd691 [TEST] Fix IndexStatsTests failures. 2014-12-18 19:33:05 +01:00
Adrien Grand ce11e0ee6d Filter cache: add a `_cache: auto` option and make it the default.
Up to now, all filters could be cached using the `_cache` flag that could be
set to `true` or `false` and the default was set depending on the type of the
`filter`. For instance, `script` filters are not cached by default while
`terms` are. For some filters, the default is more complicated and eg. date
range filters are cached unless they use `now` in a non-rounded fashion.

This commit adds a 3rd option called `auto`, which becomes the default for
all filters. So for all filters a cache wrapper will be returned, and the
decision will be made at caching time, per-segment. Here is the default logic:
 - if there is already a cache entry for this filter in the current segment,
   then return the cache entry.
 - else if the doc id set cannot iterate (eg. script filter) then do not cache.
 - else if the doc id set is already cacheable and it has been used twice or
   more in the last 1000 filters then cache it.
 - else if the filter is costly (eg. multi-term) and has been used twice or more
   in the last 1000 filters then cache it.
 - else if the doc id set is not cacheable and it has been used 5 times or more
   in the last 1000 filters, then load it into a cacheable set and cache it.
 - else return the uncached set.

So for instance geo-distance filters and script filters are going to use this
new default and are not going to be cached because of their iterators.

Similarly, date range filters are going to use this default all the time, but
it is very unlikely that those that use `now` in a not rounded fashion will get
reused so in practice they won't be cached.

`terms`, `range`, ... filters produce cacheable doc id sets with good iterators
so they will be cached as soon as they have been used twice.

Filters that don't produce cacheable doc id sets such as the `term` filter will
need to be used 5 times before being cached. This ensures that we don't spend
CPU iterating over all documents matching such filters unless we have good
evidence of reuse.

One last interesting point about this change is that it also applies to compound
filters. So if you keep on repeating the same `bool` filter with the same
underlying clauses, it will be cached on its own while up to now it used to
never be cached by default.

`_cache: true` has been changed to only cache on large segments, in order to not
pollute the cache since small segments should not be the bottleneck anyway.
However `_cache: false` still has the same semantics.

Close #8449
2014-12-18 15:51:36 +01:00
Adrien Grand 6d253aba08 Upgrade to lucene-5.0.0-snapshot-1646179. 2014-12-18 09:51:20 +01:00
Boaz Leskes ee7ed387d4 Test: use less shards in SimpleQueryTests 2014-12-18 09:02:51 +01:00
Michael McCandless 242e631e95 Core: ignore known idle threads by default in /_nodes/hot_threads
Add a new ignore_idle_threads boolean option (default true) to
/_nodes/hot_threads, to filter out threads in known idle places like
waiting on a socket select or on pulling the next task from an empty
queue.

Closes #8985

Closes #8908
2014-12-17 11:59:31 -05:00
Sebastian Utz 3f51352b54 fixup! add support for registering custom circuit breaker 2014-12-17 15:54:27 +01:00
Sebastian Utz b9843dbda9 add support for registering custom circuit breaker 2014-12-17 15:53:24 +01:00
Alex Ksikes 86e1655e4b Term Vectors: support for version and version_type
This commit adds support for version and version_type to the Term Vectors API.
This could be useful in the following case whereby the user gets a document
and later wants to generate its TVs. With version, this would ensure that only
the TVs of that particular document are generated, and error out if the
document has been updated in between.

Closes #7480
2014-12-17 15:43:15 +01:00
Lee Hinman ddf83a90dd [TEST] Inject IndexSettings, not node Settings objects
Guice was injecting the wrong Settings object
2014-12-17 10:55:13 +01:00
Lee Hinman 853879a121 Revert "Add index.data_path setting"
This reverts commit b2ec19ab36.
2014-12-17 09:39:19 +01:00
Lee Hinman 154e9d90cd [TEST] Mute IndicesCustomDataPathTests 2014-12-16 23:02:36 +01:00
Adrien Grand a50e3930c9 Terms aggs: Validate the aggregation order on unmapped terms too.
Close #8946
2014-12-16 18:50:37 +01:00
Lee Hinman b2ec19ab36 Add index.data_path setting
This allows specifying the path an index will be at.

`index.data_path` is specified in the settings when creating an index,
and can not be dynamically changed.

An example request would look like:

POST /myindex
{
  "settings": {
    "number_of_shards": 2,
    "data_path": "/tmp/myindex"
  }
}

And would put data in /tmp/myindex/0/index/0 and /tmp/myindex/0/index/1

Since this can be used to write data to arbitrary locations on disk, it
requires enabling the `node.enable_custom_paths` setting in
elasticsearch.yml on all nodes.
2014-12-16 18:25:21 +01:00
Nicholas Knize 18d56f154c Adding unit tests for clockwise non-OGC ordering
Adding unit tests to validate cw defined polys not-crossing and crossing the dateline, respectively
2014-12-16 10:54:51 -06:00
Nicholas Knize ac0e37449e Adding unit test for self intersecting polygons. Relevant to #7751 even/odd discussion
Updating documentation to describe polygon ambiguity and vertex ordering.
2014-12-16 10:54:39 -06:00
Nicholas Knize 437afd6f45 Adding dateline test with valid lat/lon pairs
Cleanup: Removing unnecessary logic checks
2014-12-16 10:54:28 -06:00
Nicholas Knize 85502ac40a Updating translation gate check to disregard order of hole vertices for non dateline crossing polys.
Updating comments and code readability

Correcting code formatting
2014-12-16 10:54:13 -06:00
Nicholas Knize e9e13d5cfc Computational geometry logic changes to support OGC standards
This commit adds the logic necessary for supporting polygon vertex ordering per OGC standards. Exterior rings will be treated in ccw (right-handed rule) and interior rings will be treated in cw (left-handed rule).  This feature change supports polygons that cross the dateline, and those that span the globe/map.  The unit tests have been updated and corrected to test various situations.  Greater test coverage will be provided in future commits.

Addresses #8672
2014-12-16 10:54:02 -06:00
Nicholas Knize f8f92f816a [GEO] OGC compliant polygons fail with ambiguity
This feature branch implements OGC compliance for Polygon/Multi-polygon.  That is, vertex order for the exterior ring follows the right-hand rule (ccw) and all holes follow the left-hand rule (cw).  While GeoJSON imposes no restrictions, a user that wants to specify a complex poly across the dateline must do so in compliance with the OGC spec, otherwise a polygon that spans the globe will be assumed.

Reference issue #8672

Fix orientation of outer and inner ring for polygon with holes.  Updated unit tests.  Bug exists in boundary condition on negative side of dateline.
2014-12-16 10:53:34 -06:00
Alex Ksikes dda33155d6 Indices API: Fix wrong search stats groups
This provides a fix to issue #7644. A new Stats object must be created, and
not a reference to the retrieved stats, before we can add stats to it.
Otherwise, we would keep on adding to the same object on subsequent calls to
IndicesStatsResponse#getPrimaries() or IndicesStatsResponse#getTotal().

Closes #7644 and #8950
2014-12-16 14:31:41 +01:00
Lee Hinman 54f2eae4d8 [TEST] Remove "compressed" field data from numeric formats
The "compressed" format was removed, so this caused warnings in the log
like:

```
[WARN ][index.fielddata          ] [node_0] [test] failed to find format
[compressed] for field [test-num], will use default
```
2014-12-16 12:38:59 +01:00
Lee Hinman 63ee24982f [TEST] Call .cleanUp() on field data cache
Now that we do not automatically call .cleanUp() when clearing the field
data cache, we need to call it after the cache clear in
RandomExceptionCircuitBreakerTests
2014-12-16 12:38:47 +01:00
Ryan Ernst 37287284e6 Settings: Remove `mapping.date.round_ceil` setting for date math parsing
The setting `mapping.date.round_ceil` (and the undocumented setting
`index.mapping.date.parse_upper_inclusive`) affect how date ranges using
`lte` are parsed.  In #8556 the semantics of date rounding were
solidified, eliminating the need to have different parsing functions
whether the date is inclusive or exclusive.

This change removes these legacy settings and improves the tests
for the date math parser (now at 100% coverage!). It also removes the
unnecessary function `DateMathParser.parseTimeZone` for which
the existing `DateTimeZone.forID` handles all use cases.

Any user previously using these settings can refer to the changed
semantics and change their query accordingly. This is a breaking change
because even dates without datemath previously used the different
parsing functions depending on context.

closes #8598
closes #8889
2014-12-15 13:13:45 -08:00
Lee Hinman 8fbf45ef2b [TEST] Make parent breaker check less strict
In cases of heavy contention, it's possible for more than 2 threads
to race to a circuit breaking exception.

Essentially this means that if we have 3 threads all trying to add 3 and
simultaneously cause a circuit breaking exception (due to retry), when
adjusting after circuit breaking we can "rewind" past what this test
expects the child breaker to be at.

This adds leeway into the check, where it's okay to be within
NUM_THREADS from the parentLimit, because each thread should only add 1
to the breaker at a time.
2014-12-15 17:06:21 +01:00
Simon Willnauer 1247774ff1 Remove Gateway abstraction
We only have a single gatweway since es 1.3. There is no need to keep all
these abstractsion and nested packages. We can fold most of it into simpler
structures.
2014-12-15 15:53:02 +01:00
Lee Hinman a8fa650ee6 [CORE] Remove IndexEngine
IndexEngine was an abstraction where we had index-level engines (instead
of shard-level) that could store meta information about the index. It
was never actually used by Elasticsearch, and only there for plugins.

This removes it, because it is a confusing abstraction and not needed,
no plugins should be implementing their own IndexEngines.
2014-12-15 14:30:44 +01:00
Boaz Leskes d62bf5f67f Discovery: concurrent node failures can cause unneeded cluster state publishing
When a node fails (or closes), the master processes the network disconnect event and removes the node from the cluster state. If multiple nodes fail (or shut down) in rapid succession, we process the events and remove the nodes one by one. During this process, the intermediate cluster states may cause the node fault detection to signal the failure of nodes that are not yet removed from the cluster state. While this is fine, it currently causes unneeded reroutes and cluster state publishing, which can be cumbersome in big clusters.

Closes #8804
Closes #8933
2014-12-15 14:01:25 +01:00
Simon Willnauer e47b753617 [SEARCH] close active contexts on SearchService#close()
When we close a node all pending / active search requests need to be
cleared otherwise a node will wait up to 30 sec for shutdown sicne there
could be open scroll requests. This behavior was introduces in 1.5 such that
versions <= 1.4.x are not affected.

Closes #8940
2014-12-15 09:41:31 +01:00
Boaz Leskes a63a055f63 Test: missing {} from log command in indexRandom 2014-12-13 17:24:46 +01:00
Boaz Leskes 22da975e34 Test: reduce join timeout in testFullRollingRestart
Occasionally a the join thread successfully connected to a just closed node and which causes the subsequent join request to time out. It's default timeout 60s throws the test off when it waits for a cluster to form.
2014-12-13 13:05:04 +01:00
Michael McCandless ae11c4654b Core: use compound file by default for merged segments < 10% of index size
Change Elasticsearch to use Lucene's defaults, to reduce file descriptor count.

Closes #8934

Closes #8919
2014-12-12 15:51:37 -05:00
Britta Weber 60e805cc1f [TEST] use ensureYellow() 2014-12-12 18:07:14 +01:00
Britta Weber 185521be4b [TEST] wait for yellow before searching 2014-12-12 17:34:07 +01:00
Britta Weber 2dc9392a34 [TEST] get trace logs for search packages 2014-12-12 17:06:16 +01:00
Lee Hinman 6bf18056b0 [CORE] Remove explicit .cleanUp() on cache clear
Calling cache.cleanUp() is kind of like calling System.gc(), meaning
that we should never have (non-test) things that rely on this
functionality.

For the field data and filter cache, we already have a periodic process
that runs this .cleanUp(), so there is no need to block index
closing/clearing on it. Instead, we can clean the field data cache in
InternalTestCluster before we check the circuit breaker.

This can help tests that time out because cleaning the cache is taking
too long
2014-12-12 13:24:45 +01:00
Simon Willnauer 42d9a57d0c [TEST] Wait for yellow before verifying - sometimes the shard is not even started 2014-12-12 12:40:34 +01:00
Simon Willnauer 498331d16f [TEST] Remove random templates for ConcurrentDynamicTemplateTests 2014-12-12 12:18:58 +01:00
Simon Willnauer 6dacf61dfc [TEST] Add test to ensure master is not prone to #8917 2014-12-12 10:59:11 +01:00
Simon Willnauer 7b82660ffc [TEST] Remove debug leftover 2014-12-12 09:29:33 +01:00
Simon Willnauer dac520170f [TEST] Close the node env after test is done 2014-12-11 21:24:15 +01:00
Simon Willnauer 3877dc618d Remove some Internal* abstractions
We have lots of boilerplate code that is unnecessarily abstracting
services ie InternalIndexShard and IndexShard or InternalIndexService and
IndexService. It's enough to have concrete classes for these core classes.

Closes #8904
2014-12-11 17:31:01 +01:00
Simon Willnauer 59534391da [GATEWAY] Cleanup LocalGatewayShardsState
This commit tries to cleanup LocalGatewayShardsState to be more efficient
and easier to understand.
2014-12-11 17:17:50 +01:00
Peter Fabian Mitchell b2bab05c29 HTTP: Add 'http.publish_port' setting to the HTTP module
This change adds a 'http.publish_port' setting to the HTTP module to configure
the port which HTTP clients should use when communicating with the node. This
is useful when running on a bridged network interface or when running behind
a proxy or firewall.

Closes #8807
Closes #8137
2014-12-11 16:10:07 +01:00
Simon Willnauer ba881a9b58 [ENGINE] Remove engine related command classes
Todaqy we pass structs to the engine to call optimize / refresh and flush.
This commit cleans up this logic to reduce complexity in the engine.
2014-12-11 15:47:24 +01:00
Jun Ohtani 80bd69811d Mappings: Fix Get field mapping api with pretty flag
Closes #6552
2014-12-11 22:56:54 +09:00
Michael McCandless 084d25cdbd Test: create private store for these test cases 2014-12-11 05:25:44 -05:00
Robert Muir a2ffe494ae [core] add best_compression option for Lucene 5.0
Upgrades lucene to latest, and supports the BEST_COMPRESSION parameter
now supported (with backwards compatibility, etc) in Lucene.
This option uses deflate, tuned for highly compressible data.

index.codec::
The default value compresses stored data with LZ4 compression, but
this can be set to best_compression for a higher compression ratio,
at the expense of slower stored fields performance.

IMO its safest to implement as a named codec here, because ES already
has logic to handle this correctly, and because its unrealistic to have
a plethora of options to Lucene's default codec... we are practically
limited in Lucene to what we can support with back compat, so I don't
think we should overengineer this and add additional unnecessary plumbing.

See also:
https://issues.apache.org/jira/browse/LUCENE-5914
https://issues.apache.org/jira/browse/LUCENE-6089
https://issues.apache.org/jira/browse/LUCENE-6090
https://issues.apache.org/jira/browse/LUCENE-6100

Closes #8863
2014-12-10 22:13:09 -05:00
Nicholas Knize aa644e3ad7 [GEO] Fix for NPE enclosed in SearchParseException for a "geo_shape" filter or query
This fix adds better error handling for parsing multipoint, linestring, and polygon GeoJSONs.  Current logic throws a NPE when parsing a multipoint, linestring, or polygon that does not comply with the GeoJSON specification. That is, if a user provides a single coordinate instead of an array of coordinates, or array of linestrings, the ShapeParser throws a NPE wrapped in a SearchParseException instead of a more useful error message.

Closes #8432
2014-12-10 16:42:36 -06:00
Simon Willnauer f308049a90 [ENGINE] Fix updates dynamic settings in InternalEngineHolder
After the refactoring in #8784 some settings didn't get passed to the
actual engine and there exists a race if the settings are updated while
the engine is started such that the actual starting engine doesn't see
the latest settings. This commit fixes the concurrency issue as well as
adds tests to ensure the settings are reflected.
2014-12-10 23:07:13 +01:00
Simon Willnauer 788d7cb451 [TEST] Reset test logger to default level 2014-12-10 22:47:03 +01:00
Britta Weber 57b77c6907 [TEST] wait for yellow to avoid searching while relocating
After upgrading shard might start relocating again. If there are no
replicas the cluster state of a node might not be up to data for
a few miliseconds and direct a search request to a node that does not
have the shard anymore. This result in the following test failures:

1> java.lang.AssertionError: Count is 99 but 101 was expected.  Total shards: 13 Successful shards: 12 & 0 shard failures:
1>     __randomizedtesting.SeedInfo.seed([1932F73B458703CA:6F4FAD3DAC55591C]:0)
1>     [...org.junit.*]
1>     org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCount(ElasticsearchAssertions.java:184)
1>     org.elasticsearch.bwcompat.BasicBackwardsCompatibilityTest.testIndexRollingUpgrade(BasicBackwardsCompatibilityTest.java:358)

Waiting for relocation finished should fix this.
2014-12-10 17:46:32 +01:00
Simon Willnauer e5a7eaff22 [TEST] Use private store for a test private engine
The test was using the same store as the suite level engine which caused
problems with write locks in some cases.

Closes #8880
2014-12-10 16:56:52 +01:00
Simon Willnauer 127255f62e [TEST] Restore test logging level after test is done 2014-12-09 23:31:24 +01:00
javanna 796ebcb88b [TEST] LoggingListener to restore the initial logger levels after any modification
Modifications to LoggingListener pushed with #8820 caused the original logger levels not to be reset after modifications, as the new state was saved for restore instead of the previous one.

 Added unit tests for LoggingListener as well.

Closes #8845
2014-12-09 14:26:13 +01:00
Simon Willnauer 8ffe8e0259 [TEST] compare strings and strings - leftover from Path API refactoring 2014-12-09 14:22:15 +01:00
Robert Muir 39186edc86 Ban java.io.File in tests.
Restrict use of java.io.File to 5 methods (excluded), but otherwise ban.
This is a prerequisite to do any mocking here.

I don't try to do any heavy cleanup on these tests, I am not familiar with them.
So this is mostly a rote straightforward conversion.

Closes #8836
2014-12-09 05:57:48 -05:00
Simon Willnauer c0d50f2a80 [TEST] Beef up InternalEngineTest and remove bogus timeouts 2014-12-09 09:31:33 +01:00
Ryan Ernst 0c8f5ac129 Tests: Additional test for memory stats api. 2014-12-08 15:43:31 -08:00
Ryan Ernst fde32cc599 Stats: Add more fine grained memory stats from Lucene segment reader.
This is a start to exposing memory stats improvements from Lucene 5.0.
This adds the following categories of Lucene index pieces to index stats:
* Terms
* Stored fields
* Term Vectors
* Norms
* Doc values
2014-12-08 15:29:43 -08:00
Robert Muir 150c2203ac Add test that ES filterreader getCoreCacheKey() behaves correctly.
Closes #8831.
2014-12-08 17:58:27 -05:00
Michael McCandless b0b96af746 Test: fix this test to work in IntelliJ 2014-12-08 15:11:06 -05:00
Simon Willnauer b28fc1afa5 [ENGINE] Add engine lifecycle store reference to EngineHolder
This commit add the engines reference to the store out of the actual
implementation into the hodler since the holder manages the actual lifcycle.
Engine internal references like per searcher or per recovery are kept inside
the actual implemenation since the have a different lifecycle.
2014-12-08 21:07:12 +01:00
tlrx 31a77185a6 Merge branch 'fix/plugins-loading' 2014-12-08 17:15:06 +01:00
tlrx 97ec8f94ae Plugins: Plugin failed to load since #8666
The method Path.endsWith(String s) doesn't work exactly the same way as String.endsWith() (see http://docs.oracle.com/javase/7/docs/api/java/nio/file/Path.html#endsWith(java.nio.file.Path)). This blocks the loading of plugins.
2014-12-08 17:13:39 +01:00
Simon Willnauer 84066128ed [TEST] Pass class level test logging to external nodes
This commit passes the test logging annotation from the class
level to the external nodes as well.

Closes #8552
2014-12-08 13:25:03 +01:00
Boaz Leskes 83bb65a020 Internal: allow InternalEngine to be stopped and started
Once the current engine is started you can only close it once. Once closed the engine cannot be started again. This commit adds a stop method which signals the engine to free it's resources but in a way that allows restarting.

This is done by introducing InternalEngineHolder which is a wrapper around InternalEngine. This allows to add the stop() method without adding complexity the engine implementation. InternalEngineHolder also serves an entry point for listeners (incoming and outgoing) to other ES components, which removes the needs add/remove them if the engine is stopped.

Closes #8784
2014-12-08 12:40:38 +01:00
Lee Hinman 83fa7bfaba [TEST] Add unit tests for DiskThresholdDecider settings 2014-12-08 12:14:09 +01:00
Simon Willnauer 8d7ce3c558 [STORE] Expose ShardId via LeafReader rather than Direcotry API
Today we try to fetch a shard Id for a given IndexReader / LeafReader
by walking it's tree until the lucene internal SegmentReader and then
casting the directory into a StoreDirecotory. This class is fully internal
to Elasticsearch and should not be exposed outside of the Store.

This commit makes StoreDirectory a private inner class and adds dedicated
ElasticsearchDirectoryReader / ElasticserachLeafReader exposing a ShardId
getter to obtain information about the shard the index / segment belogs to.

These classes can be used to expose other segment specific information in
the future more easily.
2014-12-08 12:10:28 +01:00
tlrx a046ee756d Scripting: Add explicit error message when script_score script returns NaN
When a scoring script returns not a number, the current message is confusing (IllegalArgumentException[docID must be >= 0 and < maxDoc=3 (got docID=2147483647)]). This commit adds the error message ScriptException[script score function returns a wrong score: NaN].

Closes #2426
2014-12-08 10:14:01 +01:00
Boaz Leskes 2bc48a4806 Tests: move RecoverAfterNodesTests to org.elasticsearch.gateway.local and increase BLOCK_WAIT_TIMEOUT to 10s
The tests were still in org.elasticsearch.gateway.none but the none gateway was removed.
2014-12-07 22:10:11 +01:00
Igor Motov 0b024ad2f3 Snapshot/Restore: switch to write once mode for snapshot metadata files
This commit removes creation of in-progress snapshot file and makes creation of the final snapshot file atomic.

Fixes #8696
2014-12-05 12:39:24 -05:00
Simon Willnauer 0bab17ffde [TEST] wait unitl all machines joined the cluster 2014-12-05 18:12:00 +01:00
Lee Hinman d32f1a8ad0 [TESTS] Log what the _default_ template is in ElasticsearchIntegrationTest 2014-12-05 14:45:24 +01:00
Lee Hinman caa5af4bf6 [TESTS] Use a _default_ template to load field data lazily
Previously it was possible for the field data clearing in this test to
take too long, causing the test to time out.

This also switches to using `scaledRandomIntBetween` for the number of
fields.
2014-12-05 14:45:17 +01:00
Simon Willnauer b8687163c4 [TEST] produce valid symlinks in tests 2014-12-04 17:02:38 +01:00
Martijn van Groningen 7ac713aedc Core: surgically removed slow scroll, because master (2.0) requires full cluster restart coming from previous versions. 2014-12-04 15:56:03 +01:00
Simon Willnauer 8b5bc2643e [Store] Only fail recovery if files are inconsistent
the recovery diff can return file in the `different` category
since it's conservative if it can't tell if the files are the same.
Yet, the cleanup code only needs to ensure both ends of the recovery
are consistent. If we have a very old segments_N file no checksum is present
but for the delete files they might be such that the segments file passes
the consistency check but the .del file doesn't sicne it's in-fact the same
but this check was missing in the last commit.
2014-12-04 15:48:40 +01:00
javanna ad004072bb Internal: remove optional original indices
Original indices are optional in ShardDeleteByQueryRequest only for backwards compatibility, see #7406. We can remove this in master since 2.0 will require a full cluster restart.

Closes #8777
2014-12-04 14:25:46 +01:00
Simon Willnauer 219bb88bc2 Remove runtime version checks
This cleanup commmit removes a large protion of the versioned reads / writes
in the network protocol since master requires a full cluster restart.
2014-12-04 11:31:29 +01:00
Simon Willnauer f4052fd936 Factor out PID file creation and add tests
This commit factors out the PID file creation from bootstrap and adds
tests for error conditions etc. We also can't rely on DELETE_ON_CLOSE
since it might not even write the file depending on the OS and JVM implementation.
This impl uses a shutdown hook to best-effort remove the pid file if it was written.

Closes #8771
2014-12-04 11:12:16 +01:00
Simon Willnauer ab0e3a6db2 [CLIENT] Add internal liveness action
This commit adds a very lightweight action to the transport
serivce that allows to fetch clustername and the discovery node
from a node. This is used by transport clients to test liveness of
a node without using the nodesinfo API which can be blocking if management
threadpools are busy.

Closes #8763
2014-12-04 10:49:20 +01:00
javanna 171e718f88 [DOCS] Document ActionNamesTests 2014-12-03 16:28:36 +01:00
javanna 6ccb46ef37 [TEST] remove action names bwc layer
The bwc layer added with #7105 is not needed in master as a full cluster restart will be required, thus from 2.0 on the only supported action names are compliant to the defined conventions and don't need to be converted to the old format

Closes #8758
2014-12-03 16:18:43 +01:00
Simon Willnauer d732077900 [TEST] Wait for yellow before running rescorer tests 2014-12-03 10:03:45 +01:00
javanna 36e12d39fd [TEST] guarantee REST tests execution order
REST tests are being shuffled before their execution. To guarantee their repeatability given the seed, their order needs to be always the same before the shuffling happens.

Closes #8745
2014-12-03 08:36:15 +01:00
Simon Willnauer 3dfff84043 Revert back APIs that resolve files from classpath to java.net.URL
The conversion to the Path API doesn't work if the path points
to a file inside a JAR like a config. These path must be read
while the ZIP filesystem is opened which can't be guaranteed across
the board. This commit reverts back the relevant changes to java.net.URL
and adds a util method to read UTF-8 Encoded files from URLs correctly.
2014-12-03 00:09:35 +01:00
Simon Willnauer a6510f9245 Add File.java to forbidden APIs
This commit cuts over all of core (not quite all tests) to java.nio.Path
It also adds the file class to the core forbidden APIs to prevent its usage.

This commit also resolves #8254 since we now consistently useing the NIO Path
API. The Changes in this commit allow for more information if IO operations fail
since the NIO API throws exceptions instead of boolean return values. The build-in
methods used in this commit are also more resillient to encodeing errors like
unmappable characters and throw exceptions if those chars are present in a file.

Closes #8254
Closes #8666
2014-12-02 21:29:26 +01:00
Simon Willnauer 48ec6599c2 [TEST] use private randomness in InternalTestCluster 2014-12-02 18:22:44 +01:00
Simon Willnauer e3ed471d30 [TEST] speed up tests by reducing the recovery retry by default 2014-12-02 17:43:06 +01:00
Simon Willnauer 8736543c71 [RECOVERY] Ensure shards are identical after recovery
Today we don't check if the recovery target has all the
files that we expect there after the recovery. This commit
adds aditional safety to ensure all files are present with the
correct checksums on recovery finalization.

Closes #8723
2014-12-02 14:05:44 +01:00
Simon Willnauer c1edcaf388 [RECOVERY] Make recovery delay configurable
Today we wait 500ms before we retry a recovery if the target node is not ready.
This happens if the source starts the recovery before the target has
processed the clusterstate moving the target shard into the right state.
This can cause a 500ms delay each time it happens while the shard is ready
way earlier on the target node. This commit makes this delay configurable
to mainly speed up test processing and shard allocation in tests.
2014-12-02 13:33:35 +01:00
Martijn van Groningen d7e224da04 Added `inner_hits` feature that allows to include nested hits.
Inner hits allows to embed nested inner objects, children documents or the parent document that contributed to the matching of the returned search hit as inner hits, which would otherwise be hidden.

Closes #8153
Closes #3022
Closes #3152
2014-12-02 12:01:01 +01:00
Simon Willnauer 942e752ac1 Remove unused member / argument on Store 2014-12-02 10:11:34 +01:00
Simon Willnauer 9b5b281fe8 [TEST] Ensure we have a mapping for all types on open/close 2014-12-02 10:11:04 +01:00
David Pilato 317192b647 java: QueryBuilders cleanup (add and deprecate)
Some QueryBuilders are missing or have a different naming than the other ones.

This patch is applied to branch 1.x and master (elasticsearch 1.5 and 2.0):

Added
-----

* `templateQuery(...)`
* `commonTermsQuery(...)`
* `queryStringQuery(...)`
* `simpleQueryStringQuery(...)`

Deprecated
----------

* `commonTerms(...)`
* `queryString(...)`
* `simpleQueryString(...)`
2014-12-01 14:41:25 +01:00
Simon Willnauer ade5aaae5f [TEST] Ensure that all flushes happen on PeerRecovery tests 2014-11-30 16:31:49 +01:00
Simon Willnauer c630b1e8a4 [TEST] Move NoMergePolicyProvider into it's own class 2014-11-30 16:31:49 +01:00
Simon Willnauer ca9abb1caf [TEST] wait for all shards to be allocated before IndexStatsTests runs 2014-11-29 20:11:21 +01:00
Simon Willnauer 539faf4e65 [TEST] Mute CircuitBreakerServiceTests.testMemoryBreaker
Relates to #8710
2014-11-29 20:07:19 +01:00
Simon Willnauer ef8802d878 [TEST] make sure number of shard is low in network corruption tests 2014-11-29 17:16:46 +01:00
Simon Willnauer 2d0309f0d4 [TEST] Use private random instance to build test cluster config 2014-11-29 16:06:05 +01:00
Simon Willnauer 75cc8ee097 [TEST] Speed up recoveries if tests.nighly=true 2014-11-29 15:37:15 +01:00