Commit Graph

4053 Commits

Author SHA1 Message Date
Adrien Grand 7a595d7911 IndicesQueryCacheTests: Fix test bug.
The query cache is disabled on dfs_query_then_fetch so we need to enforce
query_then_fetch instead of relying on the randomized search type set by the
test framework.
2015-03-31 12:28:02 +02:00
Adrien Grand 0a6be2c111 Merge pull request #9296 from jpountz/enhancement/remove_count_search_type
Search: Merge `search_type=count` and `size=0`.

Close #9226
2015-03-31 11:36:38 +02:00
Adrien Grand a608db122d Search: Remove the `count` search type.
This commit brings the benefits of the `count` search type to search requests
that have a `size` of 0:
 - a single round-trip to shards (no fetch phase)
 - ability to use the query cache

Since `count` now provides no benefits over `query_then_fetch`, it has been
deprecated.

Close #7630
2015-03-31 11:31:49 +02:00
Adrien Grand 171e415a47 Tests: Assert that we do not leak SearchContexts.
Even if there is a background thread that periodically closes search contexts
that seem unused (every minute by default), it is important to close search
contexts as soon as possible in order to not keep unnecessary open files or
to prevent segments from being deleted.

This check would help ensure that refactorings of the SearchContext management
like #9296 are correct.
2015-03-31 11:31:49 +02:00
Igor Motov 96f4c06f46 Automatically add "index." prefix to the settings are changed on restore if the prefix is missing
Closes #10133
2015-03-30 17:39:11 -04:00
Michael McCandless b00b2b9baa fix test concurrency bug 2015-03-30 17:39:41 -04:00
jaymode 77418ecdbd [TEST] move FakeRestRequest to org.elasticsearch.test.rest
FakeRestRequest is used by a few tests and can also be leveraged by
tests outside of elasticsearch. Moving the package will mean the class
gets exported as part of the test jar.
2015-03-30 12:01:44 -04:00
Michael McCandless 87aa39a0d2 Core: deletions (alone) should also force a refresh when version map is using too much RAM
We already force a refresh in index/create ops, to clear version map
when it's using too much RAM, but we were failing to do this for
deletes, so an app that does tons of deletes with no indexing, and has
set refresh_interval to -1, would have version map using unbounded
RAM.

Closes #10312
2015-03-30 10:25:55 -04:00
Boaz Leskes 1200d8e647 Recovery: RecoveryState.File.toXContent reports file length as recovered bytes
Closes #10310
2015-03-30 16:12:37 +02:00
Adrien Grand a1505e7164 Tests: Assert that we do not leak SearchContexts.
Even if there is a background thread that periodically closes search contexts
that seem unused (every minute by default), it is important to close search
contexts as soon as possible in order to not keep unnecessary open files or
to prevent segments from being deleted.

This check would help ensure that refactorings of the SearchContext management
like #9296 are correct.
2015-03-30 10:39:08 +02:00
javanna 38ec5084a5 [TEST] resolved compiler warnings in ShapeBuilderTests and GeoPointParsingTests 2015-03-29 11:49:36 +02:00
Sebastian Monte 9a29705c49 Fix errors reported by error-prone
I compiled elasticsearch with error-prone
(https://github.com/google/error-prone). This commit fixes the 13
errors reported by the tool.
2015-03-29 11:43:56 +02:00
Martijn van Groningen 75713f4190 Reverted commit: 20f7be3 2015-03-28 08:53:11 +01:00
Martijn van Groningen 16d8f3ce81 aggs: Fix 2 bug in `children` agg
1) multiple nested children aggs result in a NPE
2) fixed a counting bug where the same readers where post collected twice

Closes #10158
2015-03-28 08:43:40 +01:00
Martijn van Groningen 3df3259a74 inner_hits: Fix nested stored field support.
This also fixes a NPE when the nested part has been filtered out of the _source, because of _source filtering.

Closes #9766
2015-03-28 08:02:30 +01:00
Britta Weber ccf5482956 [TEST] muste test and add issue number 2015-03-27 17:35:38 +01:00
Shay Banon 6181d8ecde Fail shard when index service/mappings fails to instantiate
When the index service (which holds shards) fails to be created as a result of a shard being allocated on a node, we should fail the relevant shard, otherwise, it will remain stuck.
Same goes when there is a failure to process updated mappings form the master.

Note, both failures typically happen when the node is misconfigured (i.e. missing plugins, ...), since they get created and processed on the master node before being published.
closes #10283
2015-03-27 16:58:24 +01:00
javanna 71bd40517d [TEST] remove GlobalScopeClusterTests
We removed the global ClusterScope a while ago, its related test can be removed too.
2015-03-27 15:04:42 +01:00
Tanguy Leroux c19b7a2f61 Fix thread leak in Hunspell service
An unchecked exception might be thrown when instantiating the HunspellService, leading to thread leaks in tests.

Closes #9849
2015-03-27 09:50:11 +01:00
Ryan Ernst e0334dcb9e Core: Enable doc values by default, when appropriate
Doc values significantly reduced heap usage, which results in faster
GCs. This change makes the default for doc values dynamic: any
field that is indexed but not analyzed now has doc values. This only
affects fields on indexes created with 2.0+.

closes #8312
closes #10209
2015-03-26 22:42:35 -07:00
Britta Weber 3f459f69a7 [TEST] wait for mapping, cluster state might not be up to date yet 2015-03-27 00:51:19 +01:00
Britta Weber edb6319cea [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-26 21:06:00 +01:00
javanna 18b02d58a4 [TEST] enable inline scripts on demand in bw comp tests
We currently have a single bw comp test (FunctionScoreBackwardCompatibilityTests) that requires inline scripts on.
After introducing fine-grained script settings, we moved the internal cluster to use the newer settings, but they are not supported by older nodes started as part of the bw comp tests. Moved script settings out of the default settings, so they won't be part of the ordinary settings when running bw comp tests.
Added logic in FunctionScoreBackwardCompatibilityTests to enable dynamic scripts using the proper setting, depending on the version of the node.
2015-03-26 19:56:55 +01:00
javanna d9d1e6a67a Scripting: add support for fine-grained settings
Allow to on/off scripting based on their source (where they get loaded from), the  operation that executes them and their language.

The settings cover the following combinations:

- mode: on, off, sandbox
- source: indexed, dynamic, file
- engine: groovy, expressions, mustache, etc
- operation: update, search, aggs, mapping

The following settings are supported for every engine:

script.engine.groovy.indexed.update:    sandbox/on/off
script.engine.groovy.indexed.search:    sandbox/on/off
script.engine.groovy.indexed.aggs:      sandbox/on/off
script.engine.groovy.indexed.mapping:   sandbox/on/off
script.engine.groovy.dynamic.update:    sandbox/on/off
script.engine.groovy.dynamic.search:    sandbox/on/off
script.engine.groovy.dynamic.aggs:      sandbox/on/off
script.engine.groovy.dynamic.mapping:   sandbox/on/off
script.engine.groovy.file.update:       sandbox/on/off
script.engine.groovy.file.search:       sandbox/on/off
script.engine.groovy.file.aggs:         sandbox/on/off
script.engine.groovy.file.mapping:      sandbox/on/off

For ease of use, the following more generic settings are supported too:

script.indexed: sandbox/on/off
script.dynamic: sandbox/on/off
script.file:    sandbox/on/off

script.update:  sandbox/on/off
script.search:  sandbox/on/off
script.aggs:    sandbox/on/off
script.mapping: sandbox/on/off

These will be used to calculate the more specific settings, using the stricter setting of each combination. Operation based settings have precedence over conflicting source based ones.

Note that the `mustache` engine is affected by generic settings applied to any language, while native scripts aren't as they are static by definition.

Also, the previous `script.disable_dynamic` setting can now be deprecated.

Closes #6418
Closes #10116
Closes #10274
2015-03-26 19:56:55 +01:00
Michael McCandless 442f539802 Tests: improve back compat tests by adding delete-by-query in the transaction log on upgrade
Closes #10266
2015-03-26 10:12:22 -04:00
Ryan Ernst ae41d1e03d Mappings: Fix _field_names to be disabled on pre 1.3.0 indexes
In #9893, an enabled flag was added for _field_names.  However,
backcompat for indexes created before 1.3.0 (when _field_names
was added) was lost. This change corrects the mapper
to always be disabled when used with older indexes that
cannot have _field_names.

closes #10268
2015-03-25 14:27:24 -07:00
Ryan Ernst 693d91e41c Mappings: Remove delete mapping API
Deleting a type from an index is inherently dangerous because
the type can be recreated with new mappings which may conflict
with existing segments still using the old mappings. This
removes the ability to delete a type (similar to how deleting
fields within a type is not allowed, for the same reason).

closes #8877
closes #10231
2015-03-24 09:46:02 -07:00
Britta Weber 3add12a970 function_score: undo "Remove explanation of query score from functions"
This adds the Explanation to the explain score again. It is needed
because the explanation of script functions will otherwise not contain
an explanation of _score if boost mode is set to replace.

closes #9826
2015-03-24 15:48:48 +01:00
Nicholas Knize e43f3a941b [GEO] Fix validate_* merge policy for GeoPointFieldMapper
Fail merge if validate_lat or validate_lon values are not equal. This will prevent inconsistencies between geo_points in a merged index, and parse exceptions for bounding_box and distance filters.

Also merged separate GeoPoint test classes into a single GeoPointFieldMapperTest to be consistent with GeoShapeFieldMapperTests.

closes #10164
2015-03-24 08:15:15 -05:00
Boaz Leskes c6ce64a5e5 Remove backward compatibility layer introduced in #6149
Closes #6229
2015-03-24 13:04:59 +01:00
Colin Goodheart-Smithe 2bf42dc9a0 [TEST] explicitly map fields in SignificantTermsBWCTests 2015-03-24 11:21:06 +00:00
Robert Muir 10e6fa1963 fix build with java 9
* add compiler workarounds for JDK bug JI-9019884
* remove permgen specification during tests (this results in an error on java 9)
* fix threadpool grow/shrink to call methods in the right order (this results in IAE with java 9)
2015-03-24 00:29:24 -04:00
Boaz Leskes f5923403a1 Test: RecoveryFromGatewayTests.testReusePeerRecovery - increase concurrent recoveries
To speed up the test and prevent ensureGreen() from timing out.
2015-03-23 22:02:46 +01:00
Ryan Ernst 66669c337b Tests: Add static bwc index for 1.5.0 2015-03-23 08:04:05 -07:00
Boaz Leskes cde7d9af1c Transport: fix racing condition in timeout handling
If a request comes in at the same moment the timeout handler for it runs, we may leak a timeoutInfoHolder and erroneously log "Transport response handler not found of id" . The same issue could cause the request tracer to fire a traceUnresolvedResponse call instead of traceReceivedResponse , causing a failure of testTracerLog ( see #10187 ) .

This commit makes sure timeoutInfoHolder is visible before removing the corresponding RequestHolder. It also unifies the TransportService.Adapter#remove(requestId) with TransportService.Adapter#onResponseReceived(requestId), as they are always called together to indicate a response was received.

Closes #10187
Closes #10220
2015-03-23 14:40:08 +01:00
Boaz Leskes f5f9739117 Recovery: only cancel when primary completed relocation
When a primary moves to another node, we cancel ongoing recoveries and retry from the primary's new home. At the moment this happens when the primary relocation *starts*. It's a shame as we cancel recoveries that may be close to completion and will finish before the primary has been fully relocated. This commit only triggers the cancelation once the primary relocation is completed.

Next to this, it fixes a race condition between recovery cancellation and the recovery completion. At the moment we may trigger remove a recovered shard just after it was completed. Instead, we should use the recovery cancellation logic to make sure only one code path is followed.

All of the above caused the recoverWhileUnderLoadWithNodeShutdown test to fail (see http://build-us-00.elastic.co/job/es_core_15_debian/32/ ). The test creates an index and then increasingly disallows nodes for it, until only 1 node is left in the allocation filtering rules. Normally, this means we stay in green, but the premature recovery cancellation plus the race condition mentioned above caused a shard to be failed and stay unassigned and the test asserts to fail. This happens due to the following sequence:

- The shard has finished recovering and sent the master a shard started command.
- The recovery is cancelled locally, removing the index shard.
- Master starts shard (deleting it's other copy).
- Local node gets a cluster state with the shard started in it, which cause it to send a shard failed (to make the master aware).
- Shard is failed and can't be re-assigned due to the allocation filter.

The recoverWhileUnderLoadWithNodeShutdown is also adapted a bit to fit the current behavior of allocation filtering (in the past it used to really shut down nodes). Last, all tests in that class are given better names to fit the current terminology.

Clsoes #10218
2015-03-23 14:24:37 +01:00
Boaz Leskes 4970e3e225 Revert "Rest: Add json in request body to scroll, clear scroll, and analyze API"
This reverts commit 16083d454c.
2015-03-23 12:57:19 +01:00
Colin Goodheart-Smithe b751f0e11b added validation of reducers 2015-03-23 09:12:28 +00:00
Shay Banon 9f9ada4b7b Upgrade to Jackson 2.5.1
Note, Jackson 2.5 is less lenient when it comes to not starting an object before starting to add fields on a fresh builder, fixed where applicable.
closes #10210
2015-03-23 09:03:27 +01:00
Jun Ohtani 16083d454c Rest: Add json in request body to scroll, clear scroll, and analyze API
Add json support to scroll, clear scroll, and analyze

Closes #5866
2015-03-23 15:35:38 +09:00
Shay Banon 34c5b934f1 TEST: use the random variable
we have to use the variable instead of the static methods to reproduce failing tests
2015-03-21 19:08:33 +01:00
Shay Banon 0cc13b9d5b Schedule transport ping interval
Sometimes, when using transport client for example, through a load balancer, there is a need to send a scheduled ping message to keep each channel alive.

Add support for `transport.ping_schedule`, which controls the schedule (-1 for disabled) at which a ping message will be sent. For transport client case, it gets enabled automatically since almost always this is the desired behavior.

We use the same 6 bytes header format for the ping message, with ES header and -1 for data length for ping message, and simply continue to process the next messages once this is encountered.

closes #10189
2015-03-21 18:55:10 +01:00
javanna 65b9a94baa Benchmark api: removed leftovers
Closes #10182
Closes #10184
2015-03-21 10:36:05 +01:00
Simon Willnauer 7257345db9 Revert Benchmark API
The benchmark api is being worked on feature/bench branch and will be merged from there when ready.
2015-03-21 10:36:04 +01:00
Shay Banon 31b63b1a84 Better detection of CBOR
CBOR has a special header that is optional, if exists, allows for exact detection. Also, since we know which formats we support in ES, we can support the object major type case.
closes #7640
2015-03-20 22:06:03 +01:00
Simon Willnauer 1d357cb48a Merge pull request #10157 from spinscale/1503-cleanup-remove-bytesarray-unsafe
Cleanup: Remove unsafe field in BytesStreamInput
2015-03-20 13:14:02 -07:00
Simon Willnauer 93fedcbb88 [RECOVERY] Wipe shard state before switching recovered files live
Today we leave the shard state behind even if a recovery is half finished
this causes in rare conditions shards to be recovered and promoted as
primaries that have never been fully recovered.

Closes #10053
2015-03-20 08:42:03 -07:00
Boaz Leskes 0f2d2d0495 Test: testCancelRecoveryAndResume - add network hook before bumping replicas 2015-03-20 16:24:36 +01:00
Boaz Leskes 8c69535580 Recovery: add throttle stats
This commit adds throttling statistics to the index stats API and to the recovery state.

Closes #10097
2015-03-20 10:13:40 +01:00
javanna 4348959f9d Delete api: remove broadcast delete if routing is missing when required
This commit changes the behaviour of the delete api when processing a delete request that refers to a type that has routing set to required in the mapping, and the routing is missing in the request. Up until now the delete api sent a broadcast delete request to all of the shards that belong to the index, making sure that the document could be found although the routing value wasn't specified. This was probably not the best choice: if the routing is set to required, an error should be thrown instead.

A `RoutingMissingException` gets now thrown instead, like it happens in the same situation with every other api (index, update, get etc.). Last but not least, this change allows to get rid of a couple of `TransportAction`s, `Request`s and `Response`s and simplify the codebase.

Closes #9123
Closes #10136
2015-03-20 09:19:43 +01:00
Simon Willnauer 780fe57a2c [TEST] Add more logging to TruncatedRecoveryTests 2015-03-19 23:17:48 -07:00
Lee Hinman f14e226e82 [TEST] Add additional logging to testCorruptTranslogFiles 2015-03-19 22:58:49 -06:00
Lee Hinman 25b09ede16 [TEST] Use less shards in testShadowReplicaNaturalRelocation
This makes the assertion a bit more flexible and removes the
`ensureGreen` in favor of `ensureYellow`, which is really all that is
needed to perform a search. On slow machines the relocations can take a
while and time out the `ensureGreen`.
2015-03-19 18:12:21 -06:00
Simon Willnauer d9be606c5e [LIFECYCLE] Add before/afterIndexShardDelete callback
This commit allows code to be executed before or after a shards content
is deleted from disk. This is only executed if the shard owns the
content ie. on a shard file system only a primary shard will execute
these operations.
2015-03-19 15:47:51 -07:00
Simon Willnauer a6897aa073 [GATEWAY] Move GatewayShardsState logic into IndexShard
The index shard should take care of shard state persistence since it has
all the information and the gateway concept has been removed in master.
2015-03-19 14:48:02 -07:00
Simon Willnauer 1168347b9d [REPLICATION] Remove `async` replication
Closes #10114
2015-03-19 14:44:21 -07:00
Boaz Leskes 955ff05a5e Transport: fix potential NPE in new tracer log if request timeout
Closes #9994
2015-03-19 21:29:34 +01:00
Alexander Reelsen 16efc50139 Cleanup: Remove unsafe field in BytesStreamInput
It is only used once (otherwise it is set to `false` anyway), so copying the array in that case makes more sense.
2015-03-19 13:05:59 +01:00
Simon Willnauer 5d39bea91b [TEST] Add tests that triggers truncated files on recovery
Several issues where reported showing truncated files where footers
didn't match and checksums read past EOF. This test reproduces the issue
on the latest 1.4 branch but passes on all versions above.

Closes #10155
2015-03-19 01:03:47 -07:00
Nicholas Knize 9bd0c019f2 [TEST] Fix geo orientation integration test
Pass node name to getInstance method of internalCluster to ensure we return the indexService from a node containing the index.
2015-03-18 21:30:20 -05:00
Nicholas Knize 1a79e1c8cc [GEO] Fix orientation persistence
Fixing geo_shape field mapper to persist the orientation parameter. Also adding parsing and integration tests to ensure persistence across cluster restarts.
2015-03-18 18:55:49 -05:00
Christoph Büscher 5788289a6d [TEST] Remove 'gtelte' feature from yaml tests
Some yaml tests still used the 'gtelte' feature in their skip section.
Since all language clients support this, the feature skip can be
removed.
2015-03-18 15:31:17 -07:00
jaymode 105bdd486a [HTTP] add option to only return simple exception messages
Adds a setting to disable detailed error messages and full exception stack traces
in HTTP responses. When set to false, the error_trace request parameter will result
in a HTTP 400 response. When the error_trace parameter is not present, the message
of the first ElasticsearchException will be output and no nested exception messages
will be output.
2015-03-18 17:49:05 -04:00
Colin Goodheart-Smithe cb4ab06021 missed file in merge 2015-03-18 14:14:00 -07:00
Colin Goodheart-Smithe 2ac93098b2 Merge branch 'master' into feature/aggs_2_0
Conflicts:
	src/main/java/org/elasticsearch/search/aggregations/metrics/scripted/ScriptedMetricAggregator.java
	src/test/java/org/elasticsearch/search/aggregations/bucket/significant/SignificanceHeuristicTests.java
2015-03-18 14:13:44 -07:00
Robert Muir 5f1ed47df6 Merge pull request #10143 from rmuir/bwcompat1
use bigger back compat indexes
2015-03-18 14:49:32 -04:00
Robert Muir 3a0700862a regenerate 0.90.x indexes without completion suggester 2015-03-18 14:29:41 -04:00
Robert Muir 087b107dd2 Create bigger back compat indexes. 2015-03-18 14:16:16 -04:00
Britta Weber dca0104061 [TEST] muste test, we have an issue for it and know what is going on 2015-03-18 10:17:38 -07:00
javanna fdfdf594f9 [TEST] RepeatOnExceptionRule to rethrow unexpected exception
In case an exception was caught by the repeat rule, the retry mechanism would kick in only if the exception was the expected one. If not an NPE got thrown, while we should rather just bubble it up to the caller. This makes `NettyTransportMultiPortTests` run from a plane. An assumption would kick in to make sure that the test gets ignored but the `AssumptionViolationException` was caught and not properly re-thrown.
2015-03-18 14:08:46 +01:00
Simon Willnauer 9ad1434a3b [TEST] Add test for restoring into a shadowreplica enabled index 2015-03-17 18:26:41 -07:00
Christoph Büscher 3063f06fc7 Add randomiziation to test for derivative aggregation 2015-03-17 13:53:34 -07:00
Alexander Reelsen b8334513d7 Transport: Return useful error message on potential HTTP connect
In case a HTTP client connects to the transport protocol and issues a
HTTP method followed by a space, we can just try to be smart and return
a string back to the client to point the user to the fact that the wrong
port has been used.

Closes #2139
Closes #10108
2015-03-17 09:47:24 -07:00
Boaz Leskes b605184471 Recovery: add total operations to the `_recovery` API
This commit adds the current total number of translog operations to the recovery reporting API. We also expose the recovered / total percentage:

```
"translog": {
   "recovered": 536,
   "total": 986,
   "percent": "54.3%",
   "total_time": "2ms",
   "total_time_in_millis": 2
},
```

Closes #9368
Closes #10042
2015-03-17 07:31:29 -07:00
Martijn van Groningen ef3cb2d436 percolator: Take filters from index aliases into account when selecting queries to run on a document.
The filter from an indexed alias is as if you would filter on the metadata of a percolator query, but then the filter is defined in the index alias instead of the percolate request.

Closes #6241
2015-03-16 17:25:55 -07:00
Martijn van Groningen 4393939f5e inner_hits: Nested parent field should be resolved based on the parent inner hit definition, instead of the nested parent field in the mapping.
The behaviour is better in the case someone has multiple levels of nested object fields defined in the mapping and like to define a single inner_hits definition that is two or more levels deep.

If someone wants inner hits on a nested field that is 2 levels deep the following would need to be defined:

```
{
  ...
  "inner_hits" : {
     "path" : {
        "level1" : {
            "inner_hits" : {
               "path" : {
                  "level2" : {
                     "query" : { .... }
                  }
               }
            }
        }
     }
  }
}
```

With this change the above can be defined as:

```
{
  ...
  "inner_hits" : {
     "path" : {
        "level1.level2" : {
            "query" : { .... }
        }
     }
  }
}
```

Closes #9251
2015-03-16 16:31:03 -07:00
Colin Goodheart-Smithe 68c043f730 Fixes ignore_malformed behaviour for ip fields 2015-03-16 13:43:53 -07:00
Boaz Leskes dc4c8c2693 Tests: improve logging of external node version and build
The BWC tests also run against a snapshot build of previous release branches. Upon a failure it's important to know what commit exactly was used.

Closes #10111
2015-03-16 12:37:08 -07:00
Boaz Leskes a1f5c342af Translog: stats fail to serialize size
Closes #10105
2015-03-16 10:55:28 -07:00
Simon Willnauer 7b344f8305 Merge pull request #10102 from s1monw/remove_wait_for_merge
[ENGINE] Remove reflection call to waitForMerges
2015-03-15 22:59:44 -07:00
Simon Willnauer e2d82504cc [ENGINE] Remove reflection call to waitForMerges
Since the index writer is now final we can remove the readlock around
the forceMerge calls and use the official API to wait for merges.
2015-03-15 22:56:51 -07:00
Christoph Büscher ab5e020114 Aggregations: Be lenient when converting local to utc time in time zone roundings
This solves a problem in the time zone rounding classes where time dates that
fall into a DST gap will cause joda time library to throw an exception.
Changing the conversion methods 'strict' option to false prevents this.

Closes #10025
2015-03-15 19:57:21 -07:00
Boaz Leskes 97559c0614 Engine: update index buffer size during recovery and allow configuring version map size.
To support real time gets, the engine keeps an in-memory map of recently index docs and their location in the translog. This is needed until documents become visible in Lucene. With 1.3.0, we have improved this map and made tightly integrated with refresh cycles in Lucene in order to keep the memory signature to a bare minimum. On top of that, if the version map grows above a 25% of the index buffer size, we proactively refresh in order to be able to trim the version map back to 0 (see #6363) . In the same release, we have fixed an issue where an update to the indexing buffer could result in an unwanted exception during recovery (#6667) . We solved this by waiting with updating the size of the index buffer until the shard was fully recovered. Sadly this two together can have a negative impact on the speed of translog recovery.

During the second phase of recovery we replay all operations that happened on the shard during the first phase of copying files. In parallel we start indexing new documents into the new created shard. At some point (phase 3 in the recovery), the translog replay starts to send operation which have already been indexed into the shard. The version map is crucial in being able to quickly detect this and skip the replayed operations, without hitting lucene. Sadly #6667 (only updating the index memory buffer once shard is started) means that a shard is using the default 64MB for it's index buffer, and thus only 16MB (25%) for the version map. This much less then the default index buffer size 10% of machine memory (shared between shards).

Since we don't flush anymore when updating the memory buffer, we can remove #6667 and update recovering shards as well. Also, we make the version map max size configurable, with the same default of 25% of the current index buffer.

Closes #10046
2015-03-15 14:45:41 -07:00
Boaz Leskes a596459ed6 Test: testClusterFormingWithASlowNode - make delays less aggressive 2015-03-15 13:57:49 -07:00
Michael McCandless 7861385221 Core: remove index.fail_on_corruption setting
Now we always fail the engine if corruption is detected.

Closes #10092
2015-03-14 17:11:44 -04:00
Simon Willnauer caafad750a [TEST] Fix test to use correct type in the mapping 2015-03-14 13:18:10 -07:00
Michael McCandless 0683a66277 Core: remove index.fail_on_merge_failure
Always fail the engine if an unexpected exception is hit during merge.

Closes #10088
2015-03-14 09:53:42 -04:00
javanna ebe1a4663d [TEST] renamed variables in ScriptServiceTests 2015-03-13 12:59:40 -07:00
Lee Hinman 6aec68cd29 Revert "[QUERY] Remove lowercase_expanded_terms and locale options"
This reverts commit d1f7bd97cb.

Ryan pointed out that this needs to work with the multi term query, so
additional analysis and tests should be added.
2015-03-13 13:51:44 -06:00
Lee Hinman d1f7bd97cb [QUERY] Remove lowercase_expanded_terms and locale options
The analysis chain should be used instead of relying on this, as it is
confusing when dealing with different per-field analysers.

The `locale` option was only used for `lowercase_expanded_terms`, which,
once removed, is no longer needed, so it was removed as well.

Fixes #9978
Relates to #9973
2015-03-13 13:17:27 -06:00
javanna a8271595dc Scripting: File scripts cache key to include language to prevent conflicts
The file scripts cache key should include the language of the script to prevent conflicts between scripts with same name but different extension (hence lang). Note that script engines can register multiple acronyms that may be used as lang at execution time (e.g. javascript and js are synonyms). We then need to make sure that the same script gets loaded no matter which of the acronyms is used at execution time. The problem didn't exist before this change ad the lang was simply ignored, while now we take it into account.

This change has also some positive effect on inline scripts caching. Up until now, the same script referred to with different acronyms would be compiled and cached multiple times, once per acronym. After this change every script gets compiled and cached only once, as we chose internally the acronym used as part of the cache key, no matter which one the user provides.

Closes #10033
2015-03-12 23:18:00 -07:00
Igor Motov 55f2a547d0 Snapshot/Restore: delete operation should ignore finalizing shards on nodes that no longer exist
Related to #9924
2015-03-11 12:10:48 -07:00
Shay Banon a161cf402b fix test to close node environment
the resource check only fails on windows for some reason..., need to chase why...
2015-03-08 16:42:18 -07:00
Shay Banon 13630d8028 Remove dangling indices settings, always import it
Remove the settings around dangling indices, such as no import and timeout for deletion, we always want to import dangling indices for safety, and we should not allow to change the behavior. This also cleans up the code quite a bit.
closes #10016
2015-03-08 13:24:07 -07:00
javanna 521ac7f35a Scripting: cleanup ScriptService & friends in preparation for #6418
- Added NAME constants for each script language, avoiding to repeat the same strings all over the place.
- Simplified `compile` method signatures by removing a couple of variants. Note that all of these signatures are going to change again with #6418 as in order to compile/execute a script the caller will need to specify which operation is attempting to execute the script, info that will be provided as an additional mandatory argument.
- Removed double call to ScriptService#verifyDynamicScripting for every indexed or dynamic script.
- Decreased ScriptService inner classes visibility to private (CacheKey, IndexedScript, ApplySettings)
- Moved ScriptService inner classes to the bottom of the class, I think it makes it more readable.
- Resolved some compiler warnings

Closes #9992
2015-03-07 10:01:34 +01:00
javanna 2d2ba48c0b Tribe node: system properties and configuration settings must not be forwarded to tribe clients
The tribe node, at startup, sets up the tribe clients that will join their corresponding tribes. All of the tribe.* settings are properly forwarded to the corresponding tribe client. System properties and global configuration settings must not be forwarded to the tribe client though or they will end up overriding per tribe settings with same name causing issues.

 For instance if you set the transport.tcp.port to some defined value for the tribe node, via system property or configuration file, that same value must not be forwarded to the tribe clients, otherwise they will try and use the same port, which will be already occupied by the tribe node itself, resulting in startup failed. Same for cluster.name, which will cause the tribe clients not to join their tribes.

Closes #9576
Closes #9721
2015-03-07 09:26:46 +01:00
Matthias Wahl e15d4d1124 Internal: Fix equality check of timevalue after serialization
closes #9218
2015-03-06 13:00:31 -08:00
Britta Weber 0ca1e31392 Revert "[mappings] update dynamic fields in mapping on master even if parsing fails for the rest of doc"
This reverts commit d9a1540948.
2015-03-06 19:23:41 +01:00
Britta Weber 3abf11611b [significant terms] Use 'script_file' instead of 'script' if the script is a file 2015-03-06 18:28:33 +01:00
Britta Weber 580728dfd6 significant terms: add scriptable significance heuristic
This commit adds scripting capability to significant_terms.
Custom heuristics can be implemented with a script that provides
parameters subset_freq, superset_freq,subset_size, superset_size.

closes #7850
2015-03-06 17:06:04 +01:00
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