Commit Graph

6458 Commits

Author SHA1 Message Date
Tanguy Leroux 44ac5d057a Remove empty javadoc (#20871)
This commit removes as many as empty javadocs comments my regexp has found
2016-10-12 10:27:09 +02:00
Yannick Welsch 075047065d Keep snapshot restore state and routing table in sync (#20836)
The snapshot restore state tracks information about shards being restored from a snapshot in the cluster state. For example it records if a shard has been successfully restored or if restoring it was not possible due to a corruption of the snapshot. Recording these events is usually based on changes to the shard routing table, i.e., when a shard is started after a successful restore or failed after an unsuccessful one. As of now, there were two communication channels to transmit recovery failure / success to update the routing table and the restore state. This lead to issues where a shard was failed but the restore state was not updated due to connection issues between data and master node. In some rare situations, this lead to an issue where the restore state could not be properly cleaned up anymore by the master, making it impossible to start new restore operations. The following change updates routing table and restore state in the same cluster state update so that both always stay in sync. It also eliminates the extra communication channel for restore operations and uses standard cluster state listener mechanism to update restore listener upon successful
completion of a snapshot.
2016-10-12 09:06:37 +02:00
Nik Everett cb8fe00b0e Fix imports in GeoDistanceIT
Wildcard imports are not allowed.

Relates to #20860
2016-10-11 16:59:04 -04:00
brandonkearby a3908c4c40 Fixed writeable name from range to geo_distance (#20860)
* Fixed writeable name from range to geo_distance

* Added testGeoDistanceAggregation

* Added asserts for correct result in testGeoDistanceAggregation

* Setup mapping on test index.
2016-10-11 16:56:56 -04:00
Nik Everett f3b8e7c238 Add `s` to _cat response parameters
`s` is used for sorting!

Relates to #20658
2016-10-11 12:29:55 -04:00
Alexander Lin 10ddcc4616 Adding built-in sorting capability to _cat apis. (#20658)
* Adding built-in sorting capability to _cat apis.

Closes #16975

* addressing pr comments

* changing value types back to original implementation and fixing cosmetic issues

* Changing compareTo, hashCode of value types to a better implementation

* Changed value compareTos to use Double.compare instead of if statements + fixed some failed unit tests
2016-10-11 12:29:22 -04:00
Tanguy Leroux 3b578db365 MultiGet should not fail entirely if alias resolves to many indices (#20858)
MultiGet should not fail entirely when one of the items of a multi get request refers to an alias that points to multiple indices.

closes #20845
2016-10-11 18:07:39 +02:00
Jason Tedor 05adc14231 Revert "Display plugins versions"
This reverts commit 9411f18f27.

Relates #20807
2016-10-11 11:59:06 -04:00
Boaz Leskes c6e1ef54f9 Keep a shadow replicas' allocation id when it is promoted to primary (#20863)
Shadow replicas can not be simply promoted to primary by updating boolean like normal shards. Instead the are reinitialized and shut down and rebuilt as primaries. Currently we also given them new allocation ids but that throws off the in-sync allocation ids management. This commit changes this behavior to keep the allocation id of the shard.

Closes #20650
2016-10-11 17:57:15 +02:00
Simon Willnauer c98e3f60f7 Ensure source filtering automatons are only compiled once (#20857)
This change adds a overloaded `XContentMapValues#filter` method that returns
a function enclosing the compiled automatons that can be reused across filter
calls. This for instance prevents compiling automatons over and over again when
hits are filtered or in the SourceFieldMapper for each document.

Closes #20839
2016-10-11 15:30:38 +02:00
Tanguy Leroux e4c7d8183e XContentBuilder: Avoid building self-referencing objects (#20550)
Some objects like maps, iterables or arrays of objects can self-reference themselves. This is mostly due to a bug in code but the XContentBuilder should be able to detect such situations and throws an IllegalArgumentException instead of building objects over and over until a stackoverflow occurs.

closes #20540
closes #19475
2016-10-11 11:41:54 +02:00
Boaz Leskes 1753c49beb add promised comment to testCanResetUnreasonableSettings
it got lost in a broken git song and dance.
2016-10-11 10:44:16 +02:00
Boaz Leskes fc4645bae6 Cluster Settings Updates should not trigger circuit breakers. (#20827)
Settings updates are important to be able to help and administer a cluster in distress. We shouldn't block it due to circuit breakers. An extreme example is where we are actually trying to increase and unreasonable low setting for the circuit breaker itself.

See https://elasticsearch-ci.elastic.co/job/elastic+elasticsearch+master+g1gc/242/
2016-10-11 10:36:55 +02:00
Boaz Leskes 1fe92360bc log debug in testShadowReplicaNaturalRelocation 2016-10-11 10:35:47 +02:00
Adrien Grand 1914df7b5f Do not cache script queries. (#20799)
The cache relies on the equals() method so we just need to make sure script
queries can never be equals, even to themselves in the case that a weight
is used to produce a Scorer on the same segment multiple times.

Closes #20763
2016-10-11 09:17:21 +02:00
Clinton Gormley 971b7ec542 Added version 5.0.0-rc2 2016-10-11 08:59:45 +02:00
Simon Willnauer 44d960ea85 Handle rejected pings on shutdown gracefully (#20842)
`TcpTransport.ScheduledPing` doesn't handle rejected exceutions gracefully
if the executor is shutting down. This change adds correct exception handling
if we try to schedule another ping while the node is shutting down.
2016-10-10 22:22:48 +02:00
Simon Willnauer 37ca38df3d Expose `ctx._now` in update scripts (#20835)
Update scripts might want to update the documents `_timestamp` but need a notion of `now()`.
Painless doesn't support any notion of now() since it would make scripts non-pure functions. Yet,
in the update case this is a valid value and we can pass it with the context together to allow the
script to record the timestamp the document was updated.

Relates to #17895
2016-10-10 21:14:14 +02:00
Jim Ferenczi e874dee3bc Handle SynonymQuery extraction for the FastVectorHighlighter (#20829)
SynonymQuery was ignored by the FastVectorHighlighter.
This change adds the support for SynonymQuery in the FVH.
Although this change should be implemented in Lucene directly which is why https://issues.apache.org/jira/browse/LUCENE-7484 has been opened.
In the meantime this PR handles the issue on ES side and could be removed when LUCENE-7484 gets merged.

Fixes #20781
2016-10-10 17:46:19 +02:00
Jim Ferenczi c80a563a71 Replace org.elasticsearch.common.lucene.search.MatchNoDocsQuery with its Lucene version (org.apache.lucene.search.MatchNoDocsQuery) (#20832)
* Replace org.elasticsearch.common.lucene.search.MatchNoDocsQuery with its Lucene version (org.apache.lucene.search.MatchNoDocsQuery)

This change removes the ES version of the match no docs query and replaces it with the Lucene version.

relates #18030

* Add missing change
2016-10-10 17:45:19 +02:00
Simon Willnauer 4fd1276542 Prevent AbstractArrays from release bytes more than once (#20819)
Today we throw an assertion error if we release an AbstractArray more than once.
Yet, it's recommended to implement close methods such that they can be invoked
more than once. Guaranteed single release calls are hard to implement and some
situations might not be tested causing for instance `CircuitBreaker` to operate on
corrupted memory stats.
2016-10-10 17:30:37 +02:00
javanna e154e6a758 [TEST] reformatted comment in query tests 2016-10-10 10:53:17 +02:00
Jim Ferenczi 767a7e2329 Fix match_phrase_prefix query with single term on _all field (#20471)
* Fix match_phrase_prefix query with single term on _all field

This change fixes the match_phrase_prefix query when a single term is queried on the _all field.
It builds a prefix query instead of an AllTermQuery which would not match any prefix.

Fixes #20470

* Add missing change
2016-10-10 09:47:26 +02:00
Adrien Grand 8ab7ca5284 Source filtering should treat dots in field names as sub objects. (#20736)
Mappings treat dots in field names as sub objects, for instance

```
{
  "a.b": "c"
}
```

generates the same dynamic mappings as

```
{
  "a": {
    "b": "c"
  }
}
```

Source filtering should be consistent with this behaviour so that an include
list containing `a` should include fields whose name is `a.b`.

To make this change easier, source filtering was refactored to use automata.
The ability to treat dots in field names as sub objects is provided by the
`makeMatchDotsInFieldNames` method of `XContentMapValues`.

Closes #20719
2016-10-10 09:32:26 +02:00
Nik Everett 6418f89feb Remove NodeServicesProvider
Instead provide services where they are needed. The class worked
well as a temporary measure to easy removal of guice from the index
level but now we can remove it entirely.

-1 @Inject annotation
2016-10-08 07:35:58 -04:00
Jason Tedor 535bf92280 Upgrade Log4j 2 to version 2.7
This commit upgrades the Log4j 2 dependency to version 2.7 and removes
some hacks that we had in place to work around bugs in Log4j 2 version
2.6.2.

Relates #20805
2016-10-07 13:05:30 -05:00
Clinton Gormley 2fa1d0d5f9 Added version 2.4.1 with bwc indices 2016-10-07 19:06:52 +02:00
Nik Everett cf4038b668 DeGuice some of IndicesModule
UpdateHelper, MetaDataIndexUpgradeService, and some recovery
stuff.

Move ClusterSettings to nullable ctor parameter of TransportService
so it isn't forgotten.
2016-10-07 11:14:38 -04:00
Simon Willnauer 7452028e50 Simplify TransportAddress (#20798)
since TransportAddress is now final we can simplify it's interface a bit
and remove methods that are only used in tests or are plain delegates.
2016-10-07 15:56:54 +02:00
Colin Goodheart-Smithe 4981f2fd51 Makes freezing QueryShardContext safer by stopping overrides (#20800)
The `QueryShardContext.failIfFrozen()` and `QueryShardContext.freezeContext()`
methods should be final so that overriding/bypassing the freezing of
`QueryShardContext` is not possible. This is important so that we can
trust when the `QueryShardContext` says a request is cacheable.

This change also makes the methods that call `QueryShardContext.failIfFrozen()`
`final` so they cannot be overridden to bypass setting the request as not
cacheable.
2016-10-07 14:37:29 +01:00
Adrien Grand c1e5421b77 Make range queries round up upper bounds again. (#20582)
Elasticsearch 1.x used to implicitly round up upper bounds of queries when they
were inclusive so that eg. `[2016-09-18 TO 2016-09-20]` would actually run
`[2016-09-18T00:00:00.000Z TO 2016-09-20T23:59:59.999Z]` and include dates like
`2016-09-20T15:32:44`. This behaviour was lost in the cleanups of #8889.

Closes #20579
2016-10-07 14:22:15 +02:00
Jason Tedor d01a62908a Change separator for shards preference
The shards preference on a search request enables specifying a list of
shards to hit, and then a secondary preference (e.g., "_primary") can be
added. Today, the separator between the shards list and the secondary
preference is ';'. Unfortunately, this is also a valid separtor for URL
query parameters. This means that a preference like "_shards:0;_primary"
will be parsed into two URL parameters: "_shards:0" and "_primary". With
the recent change to strict URL parsing, the second parameter will be
rejected, "_primary" is not a valid URL parameter on a search
request. This means that this feature has never worked (unless the ';'
is escaped, but no one does that because our docs do not that, and there
was no indication from Elasticsearch that this did not work). This
commit changes the separator to '|'.

Relates #20786
2016-10-07 07:17:01 -05:00
Simon Willnauer 194a6b1df0 Remove LocalTransport in favor of MockTcpTransport (#20695)
This change proposes the removal of all non-tcp transport implementations. The
mock transport can be used by default to run tests instead of local transport that has
roughly the same performance compared to TCP or at least not noticeably slower.

This is a master only change, deprecation notice in 5.x will be committed as a
separate change.
2016-10-07 11:27:47 +02:00
Colin Goodheart-Smithe eba60ee63c Removes the now callable in the date math parser in favour of a LongSupplier (#20796)
Previous to this change the DateMathParser accepted a Callable<Long> to use for accessing the now value. The implementations of this callable would fall back on System.currentTimeMillis() if there was no context object provided. This is no longer necessary for two reasons:

We should not fall back to System.currentTimeMillis() as a context should always be provided. This ensures consistency between shards for the now value in all cases
We should use a LongSupplier rather than requiring an implementation of Callable. This means that we can just pass in context::noInMillis for this parameter and not have not implement anything.
2016-10-07 10:26:25 +01:00
Michael McCandless 0a1b8a3176 also ignore AccessDeniedException (for Windows) when checking file size for store stats (#20790)
Closes #17580
2016-10-07 05:24:15 -04:00
Ali Beyad 5d38248afa Shard Decision class improvements for Explain API (#20742)
This commit improves the shard decision container class in the following
ways:

 1. Renames UnassignedShardDecision to ShardAllocationDecision, so that
    the class can be used for general shard decisions, not just unassigned
    shard decisions.
 2. Changes ShardAllocationDecision to have the final decision as a Type
    instead of a Decision, because all the information needed from the final
    decision is contained in `Type`.
 3. Uses cached instances of ShardAllocationDecision for NO and THROTTLE
    decisions when no explanation is needed (which is the common case when
    executing reroute's as opposed to using the explain API).
2016-10-06 22:53:05 -04:00
Simon Willnauer a6fa96d513 Remove confusing capturing groups in _rollover index name pattern 2016-10-06 20:41:19 +02:00
Simon Willnauer 9c9afe3f01 Remove SearchContext#current and all it's threadlocals (#20778)
Today SearchContext expose the current context as a thread local which makes any kind of sane interface design very very hard. This PR removes the thread local entirely and instead passes the relevant context anywhere needed. This simplifies state management dramatically and will allow for a much leaner SearchContext interface down the road.
2016-10-06 19:51:54 +02:00
Igor Motov 63bcb4f534 Named analyzer should close the analyzer that it wraps 2016-10-06 10:15:33 -04:00
Boaz Leskes b847a835e9 Improve scheduling fairness when batching cluster state changes with equal priority (#20775)
As the wise man @ywelsch said: currently when we batch cluster state update tasks by the same executor, we the first task un-queued from the pending task queue. That means that other tasks for the same executor are left in the queue. When those are dequeued, they will trigger another run for the same executor. This can give unfair precedence to future tasks of the same executor, even if they weren't batched in the first run. Take this queue for example (all with equal priority)

 ```
 T1 (executor 1)
 T2 (executor 1)
 T3 (executor 2)
 T4 (executor 2)
 T5 (executor 1)
 T6 (executor 1)
 ```

 If T1 & T2 are picked up first (when T5 & T6 are not yet queued), one would expect T3 & T4 to run second. However, since T2 is still in the queue, it will trigger execution of T5 & T6.

 The fix is easy - ignore processed tasks when extracting them from the queue.

Closes #20768
2016-10-06 16:11:27 +02:00
Colin Goodheart-Smithe 40f8f281e0 Merge branch 'master' into dont_cache_scripts 2016-10-06 09:09:23 +01:00
Colin Goodheart-Smithe ce6f6d3835 Review comments 2016-10-06 08:55:31 +01:00
Adrien Grand 6174e21f47 The `top_hits` aggregation should compile scripts only once. (#20738)
Today it compiles when creating the aggregator, meaning that scripts will be
compiled as many times as there are buckets. Instead it should compile when
creating the factory so that scripts are compiled only once regardless of the
number of buckets.
2016-10-06 09:55:30 +02:00
Boaz Leskes a2e82adc6f TransportReplicationAction subclasses shouldn't have to resolve shards (#20730)
TRA currently resolves incoming requests to IndexShards in order to acquire operations locks on them. There is no need for all subclasses to have to go through the same IndicesService/IndexService song and dance. Also, doing it once means we don't need to worry about edge cases where the shard is removed while a TRA is in flight.
2016-10-06 08:45:35 +02:00
Simon Willnauer 50ca10378e Merge branch 'master' into dont_cache_scripts 2016-10-05 20:43:52 +02:00
Ali Beyad 15950b71b8 BalancedShardAllocator code improvements (#20746)
This commit improves the logic flow of BalancedShardsAllocator in
preparation for separating out components of this class to be used
in the cluster allocation explain APIs.  In particular, this commit:

 1. Adds a minimum value for the index/shard balance factor settings (0.0)
 2. Makes the Balancer data structures immutable and pre-calculated at
    construction time.
 3. Removes difficult to follow labeled blocks / GOTOs
 4. Better logic for skipping over the same replica set when one of
    the replicas received a NO decision
 5. Separates the decision making logic for a single shard from the logic
    to iterate over all unassigned shards.
2016-10-05 14:23:25 -04:00
Jason Tedor 8c4108d886 Add response params to REST params did you mean
This commit adds the response params as candidates for the did you mean
suggestions for strict REST params handling.

Relates #20753
2016-10-05 11:26:19 -04:00
Simon Willnauer a008959f7a cleanup freeze methods and move them down to QueryShardContext 2016-10-05 12:22:54 +02:00
Simon Willnauer 5687549ad8 clone the entire serach context for rewriting 2016-10-05 12:14:48 +02:00
Simon Willnauer e556c289b9 use a private rewrite context to prevent exposing isCachable 2016-10-05 11:41:49 +02:00