Commit graph

432 commits

Author SHA1 Message Date
Ryan Ernst
991e80d56e
Remove unnecessary generic params from action classes (#126364)
Transport actions have associated request and response classes. However,
the base type restrictions are not necessary to duplicate when creating
a map of transport actions. Relatedly, the ActionHandler class doesn't
actually need strongly typed action type and classes since they are lost
when shoved into the node client map. This commit removes these type
restrictions and generic parameters.
2025-04-07 16:22:56 -07:00
Rene Groeschke
e81ac2371d
[Tests] Simplify classpath for analytics javaRestTests (#124274)
This replaces the usage of a defaultDistribution for javaRestTest by the integTestDistribution.

This has a few advantages:
1. The overall dependencies on running the java rest tests are minimized.
   By using the default distribution we rely on building the whole default distribution (including all modules and plugins)
   before we can run these tests. This a) takes time and b) dramatically reduces the likelyhood of us avoiding test task execution at all as we
   basically declare the whole distro as an input. By using integTest distro we reduce the surface of the inputs dramatically which also results in faster
   execution of these tests
2. its more idiomatic as one pattern we see is that we e.g  disable the security settings that we would not need once we use the integTest distro without
   the security plugin
3. it makes test setup and its dependencies more explicit.

Point 3. might sound as like a downside at first, but for understanding what those tests are doing and what they are relying on I think its worth the 3 more lines of code.

Here are two build scans task executions:
- before the `javaRestTest` task requires `995 tasks, 2 transforms executed in 155 projects`: https://gradle-enterprise.elastic.co/s/drj5mfzsfx7ra/timeline
- after we only rely on `275 tasks, 2 transforms executed in 56 projects`: https://gradle-enterprise.elastic.co/s/jr5sblhppn4fg/timeline?page=2
2025-03-10 15:29:58 +01:00
Simon Cooper
106d7eaef5
Remove 7.11 and 7.12 transport versions (#124024) 2025-03-05 15:18:27 +00:00
Rene Groeschke
496c38e5a5
Reapply "Update Gradle wrapper to 8.13 (#122421)" (#123889) (#123896)
This reverts commit 36660f2e5f.
2025-03-05 08:02:13 +01:00
Rene Groeschke
36660f2e5f
Revert "Update Gradle wrapper to 8.13 (#122421)" (#123889)
This reverts commit e19b2264af.
2025-03-03 15:51:07 +01:00
Rene Groeschke
e19b2264af
Update Gradle wrapper to 8.13 (#122421)
* Fix Gradle Deprecation warning as declaring an is- property with a Boolean type has been deprecated.
* Make use of new layout.settingsFolder api to address some cross project references
* Fix buildParams snapshot check for multiprojet projects
2025-03-03 14:10:00 +01:00
Niels Bauman
afff39ed5c
Run XPack usage actions on local node (#122933)
These actions solely need the cluster state, they can run on any node.

Relates #101805
2025-03-03 13:37:27 +01: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
Armin Braun
4af51839d2
Speedup MultiTermsAggregator (#123220)
Creating (and more importantly eventually resizing) a fresh stream
output makes up a large chunk of the runtime of this aggregation.
Also, recursively calling an inline consumer makes this logic
even more confusing and adds additional overhead as escape analysis
will not be able to remove the allocation of the consumer.
=> just call a method recursively and reuse the output
2025-02-24 08:00:47 +01:00
Oleksandr Kolomiiets
b8d7e99cb9
Use FallbackSyntheticSourceBlockLoader for number fields (#122280) 2025-02-12 16:12:19 -08:00
Nik Everett
cff329ee40
Retry timeout tests for aggs (#122031)
The aggs timeout test waits for the agg to return and then double checks
that the agg is stopped using the tasks API. We're seeing some failures
where the tasks API reports that the agg is still running. I can't
reproduce them because computers. This adds two things:
1. Logs the hot_threads so we can see if the query is indeed still
   running.
2. Retries the _tasks API for a minute. If it goes away soon after the
   _search returns that's *fine*. If it sticks around for more than a
   few seconds then the cancel isn't working. We wait for a minute
   because CI can't be trusted to do anything quickly.

Closes #121993
2025-02-07 16:56:11 +01:00
Mark Tozzi
69b2078723
Aggregations cancellation after collection (#120944)
This PR addresses issues around aggregations cancellation, mentioned in https://github.com/elastic/elasticsearch/issues/108701 and other places. In brief, during aggregations collection time, we respect cancellation via the mechanisms in the searcher to poison cancelled queries. But once the aggregation finishes collection, there is no further need to interact with the searcher, so we cannot rely on that for cancellation checking. In particular, deeply nested aggregations can spend a long time constructing the results tree.

Checking for cancellation is a trade off, as the check itself is somewhat expensive (it involves a volatile read), so we want to balance checking often enough that cancelled queries aren't taking up resources for a long time, but not so frequently that it slows down most aggregation queries. Our first attempt to this is to check once when we go to build sub-aggregations, as the worst cases for this that we've seen involve needing to build deep sub-aggregation trees. Checking at sub-aggregation construction time also provides a conveniently centralized method call to add the check to.

---------

Co-authored-by: elasticsearchmachine <infra-root+elasticsearchmachine@elastic.co>
Co-authored-by: Nik Everett <nik9000@gmail.com>
2025-02-06 17:15:01 +01:00
Armin Braun
453db3fd71
Optimize InternalAggregations construction a little (#120868)
We can streamline and optimize this logic a little to
see less copying and more compact results.
2025-01-28 11:50:47 +01:00
Kostas Krikellas
8de9539e29
Lazy initialization for SyntheticSourceSupport.loader() (#120896)
* Lazy initialization for `SyntheticSourceSupport.loader()`

* [CI] Auto commit changes from spotless

* add missing

---------

Co-authored-by: elasticsearchmachine <infra-root+elasticsearchmachine@elastic.co>
2025-01-27 17:12:42 +02:00
Simon Cooper
39601ed683
Remove IndexNameExpressionResolver from base classes that don't use it (#120531) 2025-01-22 10:17:07 +00:00
Patrick Doyle
34059c9dbd
Limit ByteSizeUnit to 2 decimals (#120142)
* Exhaustive testParseFractionalNumber

* Refactor: encapsulate ByteSizeUnit constructor

* Refactor: store size in bytes

* Support up to 2 decimals in parsed ByteSizeValue

* Fix test for rounding up with no warnings

* ByteSizeUnit transport changes

* Update docs/changelog/120142.yaml

* Changelog details and impact

* Fix change log breaking.area

* Address PR comments
2025-01-16 19:30:23 +00:00
Simon Cooper
be049bb698
Remove most references to 7.9 and 7.10 transport versions (#118784) 2025-01-16 14:55:30 +00:00
Rene Groeschke
ba61f8c7f7
Update Gradle wrapper to 8.12 (#118683)
This updates the gradle wrapper to 8.12

We addressed deprecation warnings due to the update that includes:

- Fix change in TestOutputEvent api
- Fix deprecation in groovy syntax
- Use latest ospackage plugin containing our fix
- Remove project usages at execution time
- Fix deprecated project references in repository-old-versions
2024-12-30 15:34:24 +01:00
Simon Cooper
09ce855d83
Remove some 7.7 and 7.8 transport version checks (#118563) 2024-12-16 09:08:06 +00:00
Simon Cooper
8a4fc7ceca
Remove most uses of 7.5 and 7.6 transport versions (#118439) 2024-12-12 10:02:01 +00:00
Simon Cooper
77590834e4
Remove references to transport versions 7.3 and 7.4 (#118289) 2024-12-10 14:57:20 +00:00
Ignacio Vera
422eb1af76
Remove bucketOrd field from InternalTerms and friends (#118044)
The field bucketOrd is only used for building the aggregation but has no use after that.
2024-12-05 15:25:15 +01:00
Ignacio Vera
78400b8d05
InternalMultiBucketAggregation.InternalBucket does not implement writable anymore (#117310)
This allows to make some Bucket implementations leaner, in particular terms and multi-terms aggregations
2024-11-26 07:53:40 +01:00
Rene Groeschke
f6ac6e1c3b
[Build] Remove deprecated BuildParams (#116984) 2024-11-22 16:30:57 +01:00
Ignacio Vera
8cfe8f1c5c
MultiBucketsAggregation.Bucket does not implement ToXContent anymore (#117240)
This change makes some buckets implementation leaner.
2024-11-22 07:13:44 +01:00
Ignacio Vera
75f4232274
Check the real memory circuit breaker when building internal aggregations (#117019)
checks periodically the real memory circuit breaker when allocating objects.
2024-11-21 12:44:17 +01:00
Ignacio Vera
9296fb40ff
Use LongArray instead of long[] for owning ordinals when building Internal aggregations (#116874)
This commit changes the signature of InternalAggregation#buildAggregations(long[]) to
InternalAggregation#buildAggregations(LongArray) to avoid allocations of humongous arrays.
2024-11-19 12:26:37 +01:00
Rene Groeschke
13c8aaeffa
[Gradle] Remove static use of BuildParams (#115122)
Static fields dont do well in Gradle with configuration cache enabled.

- Use buildParams extension in build scripts
- Keep BuildParams.ci for now for easy serverless migration
-  Tweak testing doc
2024-11-15 17:58:57 +01:00
Kostas Krikellas
2054357902
Refactor DocumentDimensions to RoutingFields (#116321)
* Refactor DocumentDimensions to RoutingFields

* update

* add test

* add test

* updates from review

* updates from review

* spotless

* remove final from subclass

* fix final
2024-11-11 18:04:09 +02:00
Ignacio Vera
3438942602
Deduplicate the list of names when deserializing InternalTopMetrics (#116298)
use deduplication infrastructure to deduplicate the names of metrics in InternalTopMetrics.
2024-11-07 16:06:24 +01:00
Ignacio Vera
b1f20870bd
Reuse metric names in TopMetricsAggregator (#116296)
This commit shares a unique instance between all InternalTopMetrics instances.
2024-11-07 15:15:38 +01:00
Nhat Nguyen
f3b34f3e34
Remove old synthetic source mapping config (#115889)
This change replaces the old synthetic source config in mappings with 
the newly introduced index setting.

Closes #115859
2024-10-30 09:15:16 -07:00
Ryan Ernst
15a3a4e353
Remove XPackFeatureSet interface (#115679)
XPackFeatureSet hasn't been used for many years. But the inner "Usage" class
is still used. This commit moves the Usage class up to its own file as
XPackFeatureUsage, and removes the defunct XPackFeatureSet interface.

closes #29736
2024-10-28 15:34:57 +01:00
Christoph Büscher
6cec96cc1e
Fix TimeSeriesRateAggregatorTests file leak (#115278)
With Lucene 10, IndexWriter requires a parent document field in order to
use index sorting with document blocks. This lead to different IAE and file
leaks in this test which are fixed by adapting the corresponding location in
the test setup.
2024-10-25 15:44:59 +02:00
Kostas Krikellas
57fbbcb9e7
Fix leak in TimeSeriesRateAggregatorTests (#115345)
Fixes #115334
2024-10-23 04:05:48 +11:00
Luca Cavanna
8efd08b019
Upgrade to Lucene 10 (#114741)
The most relevant ES changes that upgrading to Lucene 10 requires are:

- use the appropriate IOContext
- Scorer / ScorerSupplier breaking changes
- Regex automaton are no longer determinized by default
- minimize moved to test classes
- introduce Elasticsearch900Codec
- adjust slicing code according to the added support for intra-segment concurrency
- disable intra-segment concurrency in tests
- adjust accessor methods for many Lucene classes that became a record
- adapt to breaking changes in the analysis area

Co-authored-by: Christoph Büscher <christophbuescher@posteo.de>
Co-authored-by: Mayya Sharipova <mayya.sharipova@elastic.co>
Co-authored-by: ChrisHegarty <chegar999@gmail.com>
Co-authored-by: Brian Seeders <brian.seeders@elastic.co>
Co-authored-by: Armin Braun <me@obrown.io>
Co-authored-by: Panagiotis Bailis <pmpailis@gmail.com>
Co-authored-by: Benjamin Trent <4357155+benwtrent@users.noreply.github.com>
2024-10-21 13:38:23 +02:00
Iván Cea Fontenla
2acb880463
Add CircuitBreaker to TDigest, Step 3: Connect with CB (#113387)
Part of https://github.com/elastic/elasticsearch/issues/99815

## Steps 1. Migrate TDigest classes to use a custom Array
implementation. Temporarily use a simple array wrapper
(https://github.com/elastic/elasticsearch/pull/112810) 2. Implement
CircuitBreaking in the `WrapperTDigestArrays` class. Add
Releasable/AutoCloseable and ensure everything is closed
(https://github.com/elastic/elasticsearch/pull/113105) 3. Pass the
CircuitBreaker as a parameter to TDigestState from wherever it's being
used (This PR)     - ESQL: Pass a real CB     - Other aggs: Use the
deprecated methods on `TDigestState`, that will use a No-op CB instead
4. Account remaining TDigest classes size ("SHALLOW_SIZE")

Every step should be safely mergeable to main: - The first and second
steps should have no impact. - The third and fourth ones will start
increasing the CB count partially.

## Remarks TDigestStates are Releasable, and should be closed now.
However, old aggregations don't close them, as it's not trivial, and as
they are using the NoopCircuitBreaker, there's no need to close them
2024-10-02 02:07:30 +10:00
Armin Braun
749ca1c5e7
Misc cleanup fieldata package (#113331)
Just some obvious cleanup and deduplication.
2024-09-21 23:26:14 +02:00
David Turner
33a366a256
Add extra context to TransportNodesAction invocations (#113140)
Several `TransportNodesAction` implementations do some kind of top-level
computation in addition to fanning out requests to individual nodes.
Today they all have to do this once the node-level fanout is complete,
but in most cases the top-level computation can happen in parallel with
the fanout. This commit adds support for an additional `ActionContext`
object, created when starting to process the request and exposed to
`newResponseAsync()` at the end, to allow this parallelization.

All implementations use `(Void) null` for this param, except for
`TransportClusterStatsAction` which now parallelizes the computation of
the cluster-state-based stats with the node-level fanout.
2024-09-19 17:33:38 +01:00
Kostas Krikellas
e244216c0f
Configure keeping source in FieldMapper (#112706)
Introduces per-field param `synthetic_source_keep` that overrides the
behavior for keeping the field source in synthetic source mode:  -
`none` : no source is stored  - `arrays`: the incoming source is
recorded as-is for arrays of a given field  - `all`: the incoming source
is recorded as is for both singleton and array values of a given field

Related to #112012
2024-09-19 23:29:09 +10:00
David Turner
079d680319 Revert "Add extra context to TransportNodesAction invocations (#113086)"
This reverts commit 3fdc8ef554.
2024-09-18 19:28:38 +01:00
David Turner
3fdc8ef554
Add extra context to TransportNodesAction invocations (#113086)
Several `TransportNodesAction` implementations do some kind of top-level
computation in addition to fanning out requests to individual nodes.
Today they all have to do this once the node-level fanout is complete,
but in most cases the top-level computation can happen in parallel with
the fanout. This commit adds support for an additional `ActionContext`
object, created when starting to process the request and exposed to
`newResponseAsync()` at the end, to allow this parallelization.

All implementations use `(Void) null` for this param, except for
`TransportClusterStatsAction` which now parallelizes the computation of
the cluster-state-based stats with the node-level fanout.
2024-09-18 19:07:26 +01:00
Oleksandr Kolomiiets
082e7211b3
Use fallback synthetic source for copy_to and doc_values: false cases (#112294) 2024-09-10 12:12:51 -07:00
Kostas Krikellas
f3bc281978
Refactor build params for FieldMapper, adding SourceKeepMode (#112455)
* Refactor build params for FieldMapper

* more mappers and tests

* more mappers

* more mappers

* spotless

* spotless

* stored by default

* Revert "stored by default"

This reverts commit bbd247d64b.

* restore storeIgnored

* sync

* list valid values for SourceKeepMode

* small refactoring

* spotless
2024-09-06 14:16:17 +03:00
Oleksandr Kolomiiets
2a9e47458b
Rework fix for stale data in synthetic source to improve performance (#112480) 2024-09-04 11:33:06 -07:00
Oleksandr Kolomiiets
38adbb0724
Prevent synthetic field loaders accessing stored fields from using stale data (#112173) 2024-08-27 14:55:00 -07:00
Patrick Doyle
35a375329a
Move Guice to org.elasticsearch.injection.guice (#111723)
* Move files and fix imports & module exports
* Other consequences of moving Guice
2024-08-12 10:47:46 -04:00
Ignacio Vera
3639eb7061
unmute HistogramPercentileAggregationTests.testBoxplotHistogram (#111223)
Test was fixed in https://github.com/elastic/elasticsearch/pull/111153

fixes https://github.com/elastic/elasticsearch/issues/110406
2024-07-24 18:51:28 +10:00
David Turner
cc964b486e AwaitsFix for #110406 2024-07-15 09:29:29 +01:00
Panagiotis Bailis
1c80c1fc9c
Unmuting tests related to free_context not being released in ESSingleNodeTestCase (#110620) 2024-07-10 14:54:52 +03:00