Commit graph

16140 commits

Author SHA1 Message Date
Luca Cavanna
905222613a
Disable concurrency when top_hits sorts on anything but _score (#123610)
We already disable inter-segment concurrency in SearchSourceBuilder whenever
the top-level sort provided is not _score. We shoudl apply the same rules
in top_hits. We recenly stumbled upon non deterministic behaviour caused by
script sorting defined within top hits. That is to be expected given that
script sorting does not support search concurrency.

The sort script can be replaced with a runtime field, either defined in the
mapping or in the search request, which does support concurrency and guarantees
predictable behaviour.
2025-02-27 21:22:17 +01:00
Armin Braun
2113a3c606
Remove needless contention in ContextIndexSearcher.timeoutOverwrites (#123609)
This doesn't have to be an instance variable nor does it need any
concurrency, it's per definition a thread-local variable so lets make it
one.
2025-02-27 17:50:17 +01:00
Yang Wang
c7e7dbe904
Abort pending deletion on IndicesService stop (#123569)
When IndicesService is closed, the pending deletion may still be in
progress due to indices removed before IndicesService gets closed. If
the deletion stucks for some reason, it can stall the node shutdown.
This PR aborts the pending deletion more promptly by not retry after
IndicesService is stopped.

Resolves: #121717 Resolves: #121716  Resolves: #122119
2025-02-27 23:43:53 +11:00
Yang Wang
2c0fb18899
[Test] Do not use ExtrasFS for fileSettingsServiceTests (#123578)
The tests expect tightly controlled set of files and should not see
random extra files.
2025-02-27 22:42:17 +11:00
Simon Cooper
06206cc66a Apply spotless directly 2025-02-27 10:17:17 +00:00
Simon Cooper
be2c699ded
Use the correct id for the multi-project transport version (#123582) 2025-02-27 10:09:54 +00:00
Tim Vernum
779e1adc4a
Replace use of 'getProject' in RoutingNodes (#123567)
When #119968 was merged into multi-project we introduced a regression by
inserting a call to `.getProject()` within the `RoutingNodes` class that
was supposed to be multi-project-aware.

This commit replaces those calls with `.indexMetadata` lookups
2025-02-27 14:44:55 +11:00
Niels Bauman
92081d4cd2 Add MP fix annotation for cluster state listeners (MP-1966)
We're catching MP exceptions when applying cluster state listeners to
avoid noise in the logs, but we shouldn't forget to remove this `catch`
block at some point in the future.
2025-02-27 12:23:39 +11:00
Niels Bauman
2607f649d4 Make handling of failure during shard recovery project-aware (MP-1967)
When a shard recovery fails, we need to able able to handle that
properly when there are multiple projects.
2025-02-27 12:23:39 +11:00
Niels Bauman
d20773577e Mark temporary metadata builder methods as deprecated (MP-1968)
These methods will be removed at some point in the future. By marking
them as deprecated, it'll be easier to spot that some code is using
these methods. Additionally, this will hopefully prevent people from
using these temporary methods.
2025-02-27 12:23:39 +11:00
Tim Vernum
f7e80e7fd2
Merge branch 'main' into feature/multi-project 2025-02-27 12:09:08 +11:00
Tim Vernum
b5ed91a6f0 Merge branch main into feature/multi-project 2025-02-27 09:38:52 +11:00
Armin Braun
da51c8ccbf
Remove lots of redundant ref-counting from transport pipeline (#123390)
We can do with a whole lot less in ref-counting, avoiding lots of contention and speeding
up the logic in general by only incrementing ref-counts where ownership is unclear while
avoiding count changes on obvious "moves".
2025-02-26 23:11:17 +01:00
Dianna Hohensee
b1e6908ef5
Add node weight changes to balance round summaries (#122195)
The node weight changes between two balancer rounds are summarized by
saving the old DesiredBalance's weights per node along with a weights
diff to reach the new DesiredBalance's weights per node. This supports
combining multiple summaries by using the oldest summary's base node
weights and summing the diffs across all summaries to reach a combined
node weight diffs.
2025-02-26 12:52:48 -05:00
Ievgen Degtiarenko
72678e85ea
Add cluster and node name to driver profile output (#123470) 2025-02-26 14:32:49 +01:00
Nikolaj Volgushev
ae46613049
Upgrade Netty to 4.1.118.Final (#122371)
This PR upgrades Netty to `4.1.118.Final`.
2025-02-26 11:44:25 +01:00
Martijn van Groningen
21b97c250b
Fix mistake in NativeArrayIntegrationTestCase, (#123459)
that affect release builds.
2025-02-26 10:31:21 +01:00
Tim Vernum
4d0c25330c Add "hasAnyIndices" method to Metadata
If all we want to know is whether the cluster has any indices, then
this new method is more efficient than using the existing
"getTotalNumberOfIndices" method
2025-02-26 18:00:24 +11:00
Tim Vernum
597ab8a7e9 Merge branch 'main' into multi-project 2025-02-26 17:57:01 +11:00
Niels Bauman
2ad3121795 Make the health node a cluster-scoped persistent task (MP-1969)
Now that the persistent task framework supports cluster-scoped
persistent tasks, we can make the health node persistent task run with
cluster scope.
2025-02-26 16:02:19 +11:00
Yang Wang
ad8e22d1ef Fix diff building for combined cluster and project persistent tasks (MP-1965)
When the combined tasks diff is used, we need to remove the separate
project and cluster tasks from the original diff.

Relates: MP-1945, MP-1938
2025-02-26 13:46:24 +11:00
Yang Wang
b882c079f6 Make persistent task framework project aware (MP-1955)
This PR is the follow-up work for MP-1945 and MP-1938 which laid the
foundation of two different scoped persistent tasks. It updates the
persistent task framework to be aware of the two task types so that it
can handle both cluster scope tasks and per-project tasks. Once these
changes are in place, we will make health-node to be the first
cluster-scope persistent task.

Relates: ES-10168
2025-02-26 13:45:09 +11:00
Ryan Ernst
8176746754
Give NamedComponentReader access to read plugins directories (#123431)
The NamedComponentReader reads a file created upon plugin installation
for stable plugins from the plugin installation dir. This commit passes
the plugins directory through to entitlements and grants server access.
2025-02-26 00:44:03 +00:00
Joe Gallo
af6014ecb5
Use ordered maps for PipelineConfiguration xcontent deserialization (#123403) 2025-02-25 15:20:01 -05:00
Matt Culbreth
3075b0776e
Remove @UpdateForV9 annotations from Data Management code (#123171)
* Remove `@UpdateForV9` as necessary backport has been done
* Change UpdateForV9 to UpdateForV10 for ESRestTestCase due to N-2 support
2025-02-25 15:05:49 -05:00
Ryan Ernst
b5e482bc91
Enable entitlements by default (#122907)
Entitlements are almost complete. This commit enables them by default,
in preparation for 8.18/9.0.
2025-02-25 09:58:39 -08:00
Keith Massey
88cf2487e7
Fixing serialization of ScriptStats cache_evictions_history (#123384) 2025-02-25 16:46:22 +00:00
Lorenzo Dematté
f929270431
Fix how we suppress logs for self-tests (#123361) 2025-02-25 14:09:30 +00:00
Martijn van Groningen
6c55099784
Store arrays offsets for ip fields natively with synthetic source (#122999)
Follow up of #113757 and adds support to natively store array offsets for ip fields instead of falling back to ignored source.
2025-02-25 13:42:41 +00:00
David Turner
d0db4cd085
Reduce licence checks in LicensedWriteLoadForecaster (#123346)
Rather than checking the license (updating the usage map) on every
single shard, just do it once at the start of a computation that needs
to forecast write loads.

Closes #123247
2025-02-25 23:50:43 +11:00
Ryan Ernst
9aaf07242c
Add pidfile access for server (#123313) 2025-02-25 10:18:56 +01:00
Ryan Ernst
5b0591e04a
Consider entitlement lib as system module (#123315)
* Consider entitlement lib as system module

Entitlements sometimes needs to perform sensitive operations,
particularly within the FileAccessTree. This commit expands the
trivially allowed check to include entitlements as one of the system
modules alongside the jdk. One consequence is that the self test must be
moved outside entitlements.

* [CI] Auto commit changes from spotless

* remove old method call

---------

Co-authored-by: elasticsearchmachine <infra-root+elasticsearchmachine@elastic.co>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2025-02-25 09:05:36 +01:00
David Turner
4a6343ad0b
Update minimum transport version in main (#123254)
Versions 9.1.0 onwards will not be wire-compatible with versions before
8.19.0. This commit sets the minimum transport version to reject
handshakes from earlier versions.
2025-02-25 07:39:14 +00:00
Stanislav Malyshev
688542b515
Increase await timeout for testCancelFailedSearchWhenPartialResultDisallowed (#123084) 2025-02-24 21:48:18 -07:00
Yang Wang
7686d47f54 Handle task type split on reading cluster state from disk (MP-1964)
An old node writes all tasks in the metadata custom. A new old must be
able to read it and separate the cluster-scoped and project-scoped tasks
and store them in the right place. This PR does that.

Relates: MP-1945, MP-1938
2025-02-25 04:19:40 +00:00
Tim Vernum
77bf65d9af Merge main into multi-project 2025-02-25 10:33:53 +11:00
Ryan Ernst
ad99b0d3e8
Add shared_repo relative dir for files entitlement (#123221)
This commit adds the shared repo path as a relative base dir. However,
it does not make this available to policy files, only to server.
2025-02-24 11:39:26 -08:00
Samiul Monir
5664f4f2ba
Improved error message when index field type is unknown (#122860)
* Updating error message when index field type is unknown

* Fix style issue

* Add yaml test for invalid field type error message

* Update docs/changelog/122860.yaml

* Updating error message for runtime and multi field type parser

* add and fix yaml tests

* Fix code styles by running spotlessApply

* Update changelog

* Updatig the test in yml

* Updating error message for runtime

* Fix failing yaml tests

* Update error message to Fix unit tests

* fix serverless qa test

---------

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2025-02-24 13:16:22 -05:00
David Turner
d007dae1ad
Remove redundant IndexNameExpressionResolver params (#123258)
Follow-up to #120531 to remove all the now-redundant constructor
parameters.
2025-02-25 04:08:31 +11:00
Niels Bauman
116b045139 Merge main into multi-project 2025-02-24 17:43:47 +01:00
Andrei Dan
760b2312ea
Periodically check the available memory when fetching search hits source (#121920)
When fetching documents, sometimes we need to load the  entire source of
search hits. Document sources can be large,  and with support for up to
10k hits per search request, this creates  a significant untracked
memory load on Elasticsearch that can  potentially cause out-of-memory
errors.

This PR adds memory checking for hits source in the fetch phase. We
check with the parent (the real memory) circuit breaker every  1MiB of
loaded source and when fetching the last document of every segment. This
gives the real memory breaker a chance to interrupt  running operations
when we're running low on memory, and prevent  potential OOMs. 

The amount of local accounting to buffer is controlled by the 
`search.memory_accounting_buffer_size` dynamic setting and defaults to
`1MiB`.

Fixes #89656
2025-02-25 03:25:14 +11:00
jeffganmr
22103de150
fix stale data in synthetic source for string stored field (#123105) 2025-02-24 07:22:48 -08:00
Iván Cea Fontenla
c40c5a6c0a
ESQL: Fix functions emitting warnings with no source (#122821)
Fixes https://github.com/elastic/elasticsearch/issues/122588

- Replaced `Source.EMPTY.writeTo(out)` to `source().writeTo(out)` in functions emitting warnings
  - Did the same on all aggs, as Top emits an error on type resolution. This is not a bug, as type resolution errors should only happen in the coordinator. Another option would be changing Top to not generate that error there, and make it implement instead `PostAnalysisVerificationAware`
- In some cases, we don't even serialize an empty source. So I had to add a new `TransportVersion` to do so
  - As an special case, `ToLower` and `ToUpper` weren't serializing a source, but they don't emit warnings. As they were the only remaining functions not serializing the source, I added it there too
2025-02-24 13:52:41 +00:00
Armin Braun
cae7f0a809
Use inheritance instead of composition to simplify search phase transitions (#119272)
We only need the extensibility for testing and it's a lot easier to
reason about the code if we have explicit methods instead of overly
complicated composition with lots of redundant references being retained
all over the place.

-> lets simplify to inheritance and get shorter code that performs more
predictably (especially when it comes to memory) as a first step.
This also opens up the possibility of further simplifications and
removing more retained state/memory as we go through the search phases.
2025-02-24 14:26:22 +01:00
David Turner
187b192dfe
Deduplicate allocation stats calls (#123246)
These things can be quite expensive and there's no need to recompute
them in parallel across all management threads as done today. This
commit adds a deduplicator to avoid redundant work.
2025-02-25 00:21:10 +11:00
Armin Braun
236b955b95
Speedup SearchResponse serialization (#123211)
No need to have a nested concat here. There's obviously lots and lots of
room for optimization on this one, but just flattening out one obvious
step here outright halves the number of method calls required when
serializing a search response. Given that method calls can consume up to
half the serialization cost this change might massively speed up some
usecases.
2025-02-24 12:00:29 +01:00
Armin Braun
2a9de3f57f
Avoid creating IndexSearcher in Engine.refreshNeeded (#123218)
Checking whether we need to refresh does not require a searcher
so we can simplify this to just work based on the reader
and avoid lots of contention etc. for setting up the searcher.

relates #122374
2025-02-24 11:59:39 +01:00
Armin Braun
c06bde4c62
Cleanup duplication and dead code around ChunkedToXContentHelper (#123217)
Cleans up a couple things that are obviously broken:

* duplicate array and object constructs where the helper utility
  generates the exact same iterator
* unused helper methods
* single iterator concatenations
2025-02-24 11:57:37 +01:00
Carlos Delgado
f5e2a92a31
Add rescore knn vector test coverage (#122801) 2025-02-24 07:47:05 +00:00
Tim Vernum
fd9f8e1b08 Merge main into multi-project 2025-02-22 16:42:59 +11:00