Commit Graph

61094 Commits

Author SHA1 Message Date
Martijn van Groningen feaf4983de
Remove RoutingTable#shardsWithState(...) (#78959)
Replaced all usages of this method with: `RoutingNodes#shardsWithState(...)`
2021-10-12 10:55:53 +02:00
István Zoltán Szabó c9ec9a35a5
[DOCS] Adds link that points to Java API Client to HLRC deprecation note. (#78957) 2021-10-12 10:04:43 +02:00
Martijn van Groningen 9702d3fbfc
Replace RoutingTable#shardsWithState(...) with RoutingNodes#unassigned(...) (#78931)
Replaces only the production use cases of `RoutingTable#shardsWithState(...)` with `RoutingNodes#unassigned()`.

Relates to #77466
2021-10-12 09:30:21 +02:00
Armin Braun 0cf1a695e3
Add Utility to Wrap List Unmodifiable if Non-Empty (#78894)
Saving some memory in these which can easily use up tens of MBs for large index counts
just for duplicate empty lists in some cases.
2021-10-12 09:20:03 +02:00
Yang Wang 705f73a627
Skip loading authorized indices if requests do not need them (#78321)
Some indices requests support expanding wildcards. During authorization,
wildcard expansion is performed against the list of authorized indices
that the user has access to. The expansion (resolvedIndices) are then
used to replace the original indices. These indices requests shares a
common interface of IndicesRequest.Replaceable.

The observation is that indices requests that are not Replaceable do not
need expanding wildcards which in turn remove the need for the list of
authorized indices.

This PR skips loading of authorized indices when the indices requests
are not replaceable, e.g. ShardSearchRequest,
FieldCapabilitiesIndexRequest. This should help the node on the receving
end of the request handling, i.e. handler of fan-out requests.
2021-10-12 14:50:00 +11:00
Roberto Seldner 9a9d209df6
Index prefixes for searchable snapshots (#78474)
* Index prefixes for searchable snapshots

added a note about how ILM managed indices are prefixed with "restored-" or "partial-" when they are either fully or partially mounted for searchable snapshots

* Apply suggestions from code review

Co-authored-by: debadair <debadair@elastic.co>
2021-10-11 17:08:09 -07:00
Yang Wang 13f83047a6 [Test Mute] Mute testSearchResultsVersusKeywordField
Relates: #78949
2021-10-12 10:37:33 +11:00
Ryan Ernst 03a45770ef
Revert "Convert index path listeners to single path (#72511)" (#78935)
This reverts commit fd138f578b.

The revert was effectively conflict free, there was only a very minor
static import that needed fixing.

relates #78525
relates #71205
2021-10-11 13:44:45 -07:00
Ryan Ernst 61ed2e7515
Remove use of Joda from test framework (#78851)
The test base class ESTestCase provides methods to get a random
timezone. It has methods for Joda, java.time and java.util timezones.
This commit reworks the test helper methods to no longer use Joda. Due
to backcompat tests for sql, the random timezones need to be limited to
those that are still useable by Joda. To filter the available timezones
not available in Joda, the unsupported timezone ids are hardcoded in
testcase initialization.
2021-10-11 13:44:26 -07:00
Adam Locke 2d433169e4
[DOCS] Clarify cold tier functionality (#78933) 2021-10-11 16:24:21 -04:00
Mark Tozzi 5aa200c168
Update versions after backport (#78934) 2021-10-11 15:06:06 -04:00
Artem Prigoda f266eb3245
Deprecate returning 408 for a server timeout on `_cluster/health` (#78180)
Add a deprecation warning and a system property es.cluster_health.request_timeout_200 to opt in for returning 200 which will be the default in 8.0.0

Fixes #70849
2021-10-11 21:04:56 +02:00
Lukas Wegmann 8bcbebbf0d
[DOCS] Mention option to return String in sort context (#76105)
* Painless: Mention option to return String in sort context

* Adjust wording
2021-10-11 14:48:50 -04:00
Ryan Ernst 5744ed5161
Revert "Make NodeEnvironment.nodeDataPaths singular (#72432)" (#78861)
This reverts commit 6a7298e555.

The revert was not clean. There were two adjustements necessary.
First, this effectively must revert #73136. Second, some tests
were written after MDP removal so needed to be made multi path aware.

relates #78525
relates #71205
2021-10-11 11:20:05 -07:00
Ryan Ernst c5e04e11df
Remove Joda from remaining xpack tests (#78805)
This commit removes uses of Joda classes from rollup and other xpack
tests still utilizing them, mostly around time zones.
2021-10-11 11:14:56 -07:00
Mark Tozzi b968fcbca1
Scale doubles to floats when necessary to match the field (#78344)
This fixes a bug where the range aggregation always treats the range end points as doubles, even if the field value doesn't have enough resolution to fill a double. This was creating issues where the range would have a "more precise" approximation of an unrepresentable number than the field, causing the value to fall in the wrong bucket.

Note 1: This does not resolve the case where we have a long value that is not precisely representable as a double. Since the wire format sends the range bounds as doubles, by the time we get to where this fix is operating, we've already lost the precision to act on a big long. Fixing that problem will require a wire format change, and I'm not convinced it's worth it right now.

Note 2: This is probably still broken for ScaledFloats, since they don't implement NumberFieldType.

Resolves #77033
2021-10-11 11:53:36 -04:00
Christoph Büscher d713c958ff
Add ability to retrieve _id via fields option
Currently we exclude metadata fields from being looked up using the `fields` option in search.
However, as issue like #75836 show, they can still be retrieved e.g. via aliases and then fetching
their values causes errors. 
With this change, we enable retrieval of metadata fields (like `_id`) using the fields option when
 the field is explicitely asked for. We still continue to exclude any metadata field from matching
wildcard patterns, but they should be retrievable via an exact name or if there is an alias definition
with a path to a metadata field. This change adds support for the `_id` field in particular.
2021-10-11 17:33:58 +02:00
James Rodewig e7ab7c82a7
[DOCS] Update `runs` syntax (#78922)
Updates the EQL syntax docs for PR #78895.
2021-10-11 10:40:10 -04:00
Martijn van Groningen 11840f0940
Unmute bwc tests and adjust bwc serialization in DiscoveryStats (#78917)
See #77552
2021-10-11 09:43:07 -04:00
markharwood 216f135412
Wildcard field regex query fix (#78839)
Fix for wildcard field query optimisation that rewrites to a match all for regexes like .*

A bug was found in this complex rewrite logic so we have simplified the detection of .* type regexes by examining the Automaton for the regex rather than our parsed form of it which is expressed as a Lucene BooleanQuery. The old logic relied on a recursive "simplify" function on the BooleanQuery which has now been removed. We now rely on Lucene's query rewrite logic to simplify expressions at query time and consequently some of the tests had to change to do some of this rewriting before running test comparisons.

Closes #78391
2021-10-11 14:42:17 +01:00
James Rodewig db4d1c53cf
[DOCS] Add doc preview links to docs README (#78857)
I often get asked where to find doc preview links for PRs. This adds some related
docs to docs/README.
2021-10-11 09:24:03 -04:00
xiaoping 7e08c6b98a
Data stream support read and write with custom routing and partition size (#74394) 2021-10-11 07:14:15 -05:00
Martijn van Groningen d90035cd40
Mute all bwc tests for backporting #77552 (#78916) 2021-10-11 13:54:16 +02:00
Przemysław Witek 5273ebe8c5
Mute MlHiddenIndicesFullClusterRestartIT (#78914) 2021-10-11 13:37:29 +02:00
Hendrik Muhs fd4dca8e14
[Transform] HLRC cleanups (#78909)
removes some "data frame" leftovers in transform code, no functional changes
2021-10-11 12:22:56 +02:00
Przemysław Witek 0a6b6d9d68
[ML] Make ML indices hidden when the node becomes master (#77416) 2021-10-11 11:55:35 +02:00
Armin Braun 68ee6d4fe1
Introduce a Few Settings Singleton Instances (#78897)
This is mostly motivated by the ILM steps changes, that showed up as hot in
profiling since instantiating a `Settings` instance turns out to be somewhat expensive.
Also cleans up a couple of other spots and some duplication as well.
2021-10-11 10:50:32 +02:00
Rene Groeschke 2e69f6d820
Simplify TestCluster extraJar configuration (#78837)
Allow passing FileCollection instead of single Jar files. This makes using the API way easier
as gradle configurations for resolving jars do not need to be resolved eagerly
2021-10-11 10:16:03 +02:00
weizijun 5f737a9759
Add @Override annotations to methods in EnrichPlugin class (#76873) 2021-10-11 09:31:47 +02:00
Yang Wang d2cae33074
Add v7 restCompat for invalidating API key with the id field (#78664)
This PR restore the id field for InvaliateApiKey API so it can be used
if the request explicitly requires v7 compatibility.

Relates: #66671
2021-10-11 16:39:04 +11:00
Costin Leau cb983a9ed2
EQL: Refine repeatable queries (#78895)
Allow individual queries within a sequence to be repeated through a
dedicated keyword without having physical duplication.
Change from using [runs=2] to "with runs=2"

Before:

sequence
queryA [runs=2]
queryB
queryC [runs=3]
queryD

Now:

sequence
queryA with runs=2
queryB
queryC with runs=3
queryD

Which essentially is the same as:

sequence
queryA
queryA
queryB
queryC
queryC
queryC
queryD

but more concise.

Supersedes #75082
2021-10-10 23:04:19 +03:00
Joe Gallo c2fd94f7c5
Fix DataTierTests package and add a validation test (#78880) 2021-10-08 15:18:48 -04:00
Chris Hegarty 20c9f756d2
Fix split package org.elasticsearch.common.xcontent (#78831)
Fix the split package org.elasticsearch.common.xcontent, between server and the x-content lib. Move the x-content lib exported package from org.elasticsearch.common.xcontent to org.elasticsearch.xcontent ( following the naming convention of similar libraries ). Removing split packages is a prerequisite to modularization.
2021-10-08 17:14:26 +01:00
Armin Braun 7cb2d059ae
Store DataTier Preference directly on IndexMetadata (#78668)
The data tier preference is very expensive to parse out of the setting string
repeatedly for large number of indices when using it in the data tier allocation decider.

=> as done with other index settings relevant to allocation, this commit moves the data tier
preference to a field in `IndexMetadata`. The required moving the `DataTier` class itself to
`server`. In a follow-up we can look into making the setting a list setting to remove the
duplication around turning the string value into a list in various places.
2021-10-08 14:59:18 +02:00
Lisa Cawley 3d6074b76e
[DOCS] Fixes typo in calendar API example (#78867) 2021-10-07 17:51:14 -07:00
Gordon Brown 65d2b0909f
Improve Node Shutdown Observability (#78727)
* Increase node shutdown logging level when stalled

* Add allocation explanation to STALLED response

* Adjust logging levels per review

* Include all SingleNodeShutdownMetadata fields in logs

* Depluralize `node_shutdown_decisions` per review

* Repluralize node_allocation_decisions when we're actually reading from the Allocation Explain API
2021-10-07 20:03:47 -04:00
Ryan Ernst 8272438ecd
Convert encrypted snapshot license object to LicensedFeature (#78731)
This commit moves the encrypted snapshot license checks to use the new
LicensedFeature class.
2021-10-07 16:00:34 -07:00
Ryan Ernst 2fe2c800f6
Revert "Make nodePaths() singular (#72514)" (#78801)
This reverts commit 2dc796a747.

The revert was mostly clean, but it required adjusting
NodeEnvironment.upgradeLegacyNodeFolders to retain #74921.

relates #78525
relates #71205
2021-10-07 14:49:45 -07:00
Asce Ma f2360e85e8
Fix incorrect generic type in PolicyStepsRegistry (#78628) 2021-10-07 16:13:19 -04:00
Lisa Cawley df5dde5b3c
[DOCS] Fixes ML get calendars API (#78808) 2021-10-07 12:22:11 -07:00
William Brafford 0a28c7cb91
Implement GET API for System Feature Upgrades (#78642)
* Implement and test get feature upgrade status API
* Add integration test for feature upgrade endpoint
* Use constant enum for statuses
* Add unit tests for transport class methods
2021-10-07 15:18:47 -04:00
Nikola Grcevski 631e066983
[TEST] More MetadataStateFormat tests (#78577)
- Add test about partial failure on multi-paths
- Add test for deleteMetaState

Co-authored-by: Henning Andersen <33268011+henningandersen@users.noreply.github.com>
2021-10-07 13:59:43 -04:00
Lee Hinman fe1fc5f7d3
Add support for rest compatibility headers to the HLRC (#78490)
This adds support for the headers necessary for REST version compatibility to the High Level Rest
Client (HLRC).

Compatibility mode can be turned on either with the .setAPICompatibilityMode(true) when creating
the client, or by setting the ELASTIC_CLIENT_APIVERSIONING to true similar to our other
Elasticsearch clients.

Resolves #77859
2021-10-07 11:44:23 -06:00
Keith Massey 90e340cb64
Un-ignoring tests after backporting fix (#78830)
Un-ignoring compatibility tests after backporting #78531
Relates #78531
2021-10-07 11:56:11 -05:00
Lee Hinman 6e875d0fa9
Add node REPLACE shutdown implementation (#76247)
* WIP, basic implementation

* Pull `if` branch into a variable

* Remove outdated javadoc

* Remove map iteration, use target name instead of id (whoops)

* Remove streaming from isReplacementSource

* Simplify getReplacementName

* Only calculate node shutdowns if canRemain==false and forceMove==false

* Move canRebalance comment in BalancedShardsAllocator

* Rename canForceDuringVacate -> canForceAllocateDuringReplace

* Add comment to AwarenessAllocationDecider.canForceAllocateDuringReplace

* Revert changes to ClusterRebalanceAllocationDecider

* Change "no replacement" decision message in NodeReplacementAllocationDecider

* Only construct shutdown map once in isReplacementSource

* Make node shutdowns and target shutdowns available within RoutingAllocation

* Add randomization for adding the filter that is overridden in test

* Add integration test with replicas: 1

* Go nuts with the verbosity of allocation decisions

* Also check NODE_C in unit test

* Test with randomly assigned shard

* Fix test for extra verbose decision messages

* Remove canAllocate(IndexMetadat, RoutingNode, RoutingAllocation) overriding

* Spotless :|

* Implement 100% disk usage check during force-replace-allocate

* Add rudimentary documentation for "replace" shutdown type

* Use RoutingAllocation shutdown map in BalancedShardsAllocator

* Add canForceAllocateDuringReplace to AllocationDeciders & add test

* Switch from percentage to bytes in DiskThresholdDecider force check

* Enhance docs with note about rollover, creation, & shrink

* Clarify decision messages, add test for target-only allocation

* Simplify NodeReplacementAllocationDecider.replacementOngoing

* Start nodeC before nodeB in integration test

* Spotleeeessssssss! You get me every time!

* Remove outdated comment
2021-10-07 12:07:46 -04:00
Rene Groeschke f16a6990bb
Wrap VersionPropertiesLoader in a BuildService to decouple build logic projects (#78704)
By using a BuildService we can decouple the configuration of projects but keep making
expensive operations (e.g. parsing properties file or reading minimumJavaCompiler from file) only once
per build.

This bring us closer to decouple projects and get ultimatively configuration cache compliant. In
general we will bring in more BuildServices for the main build to follow along that Pattern and
ultimatevely remove usages of allprojects and subprojects in our build.
2021-10-07 18:00:21 +02:00
David Turner 5823ad695d
Adjust /_cat/templates not to request all metadata (#78829)
Today `GET /_cat/templates` retrieves the whole cluster metadata from
the master, which includes all sorts of unnecessary junk and consumes
significant resources. This commit reimplements these endpoints using
`GetIndexTemplatesAction` and `GetComposableIndexTemplateAction` which
are much more efficient.

The docs for this API indicate that it accepts a comma-separated list of
template names/patterns of the form `GET /_cat/templates/name1,name2`
but in fact today it only accepts a single name or pattern. This commit
also adds support for multiple names/patterns as the docs claim.
2021-10-07 16:43:25 +01:00
Lisa Cawley bcd75c3203
[DOCS] Fixes ML get scheduled events API (#78809) 2021-10-07 08:34:58 -07:00
Henning Andersen f8793c6a0c
Enable exit on out of memory error (#71542)
Rather than rely on ElasticsearchUncaughtExceptionHandler, it is safer
to use the JVM's built-in support for terminating the process on OOM.
2021-10-07 17:18:22 +02:00
David Turner de97cb72cc Revert "Adjust /_cat/templates not to request all metadata (#78812)"
This reverts commit b07dbe52ca.
2021-10-07 14:03:17 +01:00