Commit Graph

80003 Commits

Author SHA1 Message Date
Iván Cea Fontenla 1faa351760
Add CircuitBreaker to TDigest, Step 2: Add CB to array wrappers (#113105)
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 `MemoryTrackingTDigestArrays` class. Add `Releasable` and ensure it's always closed within TDigest (This PR)
3. Pass the CircuitBreaker as a parameter to TDigestState from wherever it's being used
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
To simplify testing the CircuitBreaker, added a helper method + `@After` to ESTestCase.

Right now CBs are usually tested through MockBigArrays. E.g:
f7a0196b45/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/AbstractFunctionTestCase.java (L1263-L1265)
So I guess there was no need for this yet. But I may have missed something somewhere.

Also, I'm separating this PR from the "step 3" as integrating this (CB) in the current usages may require some refactor of external code, which may be somewhat more _dangerous_
2024-09-26 16:03:29 +02:00
Dan Rubinstein 701ed61fd3
Adding inference endpoint creation validation for MistralService, GoogleAiStudioService, and HuggingFaceService (#113492)
* Adding inference endpoint creation validation for MistralService, GoogleAiStudioService, and HuggingFaceService

* Moving invalid model type exception to shared ServiceUtils function

* Fixing naming inconsistency

* Updating HuggingFaceIT ELSER tests for inference endpoint validation
2024-09-26 09:35:54 -04:00
Benjamin Trent 1b67dabadb
Fix collapse interaction with stored fields (#112761)
Collapse dynamically will add values to the DocumentField values array.
There are a few scenarios where this is immutable and most of these are
OK. However, we get in trouble when we create an immutable set for
StoredValues which collapse later tries to update.

The other option for this fix was to make an array copy for `values` in
every `DocumentField` ctor, this seemed very expensive and could get out
of hand. So, I decided to fix this one bug instead.

closes https://github.com/elastic/elasticsearch/issues/112646
2024-09-26 22:51:02 +10:00
Salvatore Campagna e2281a1158
Introduce an `IndexSettingsProvider` to inject logsdb index mode (#113505)
Here we introduce a new implementation of `IndexSettingProvider` whose goal is to "inject" the
`index.mode` setting with value `logsdb` when a cluster setting `cluster.logsdb.enabled` is `true`.
We also make sure that:
* the existing `index.mode` is not set
* the datastream name matches the `logs-*-*` pattern
* `logs@settings` component template is used
2024-09-26 14:44:03 +02:00
elasticsearchmachine fc9954e031 Mute org.elasticsearch.integration.KibanaUserRoleIntegTests testSearchAndMSearch #113593 2024-09-26 22:26:58 +10:00
elasticsearchmachine 5c6778cc86 Mute org.elasticsearch.integration.KibanaUserRoleIntegTests testFieldMappings #113592 2024-09-26 22:26:40 +10:00
Kostas Krikellas b344493298
Rest skipped tests after backporting (#113591)
The skip test entries were added in
https://github.com/elastic/elasticsearch/pull/113584, no longer needed
after backporting it.
2024-09-26 21:57:31 +10:00
Luigi Dell'Aquila 98db01b271
ES|QL: Fix warnings for date tests (#113586)
Fixes: https://github.com/elastic/elasticsearch/issues/113540 Fixes:
https://github.com/elastic/elasticsearch/issues/113539

More generic warning regex for Java 23 date patterns

(already fixed in 8.x, no need to backport)
2024-09-26 20:22:49 +10:00
Nikolaj Volgushev 0d275c65dc
Log when clients are randomly reset in ITs (#113510)
This is useful for debugging tests and should not be too noisy since
it's a rare event.
2024-09-26 20:06:28 +10:00
Nikolaj Volgushev 11c0bf8d6e
Fix cancellation race condition in `onIndexAvailableForSearch` (#113386)
This PR fixes following race conditions in `onIndexAvailableForSearch`
introduced in https://github.com/elastic/elasticsearch/pull/112813:

1. If the method is called when the index is already available, cancellation is still scheduled and may execute before successful completion (manifested in test failures https://github.com/elastic/elasticsearch/issues/113336)
2. If the cancel task runs _before_ `addStateListener`, it may fail to remove the listener (noticed while fixing the first issue)

These race conditions only manifest for small timeout windows, and are
completely bypassed for 0 timeout windows based on other checks in prod
code, so the practical impact is fortunately limited.

Resolves: https://github.com/elastic/elasticsearch/issues/113336
2024-09-26 19:19:46 +10:00
Brian Seeders e9b303322c
Fix packaging tests after addition of new wolfi-based image (#112831)
* Add more missing wolfi references to fix tests
* packaging tests require access to docker registry
* Fix symlink for es distributions jdk cacerts in wolfi docker
* Fix native support on wolfi images
* Fix provided keystore packaging tests for wolfi
* Add utils used for testing to wolfi image
* Explicitly set default shell to bash in docker images
* Fix docker config issues
* Apply review feedback around docker login

---------

Co-authored-by: Rene Groeschke <rene@elastic.co>
2024-09-26 11:11:01 +02:00
Iraklis Psaroudakis 4798037fba
Log exceptions in IndicesLifecycleListener tests (#113547)
Because the finally clause assertions did not finally print any
exceptions that might have occurred.

Happened in build scan qdorbubrxbqh6. And can be easily reproduced
e.g., by using a custom metadata:

metadata =
IndexMetadata.builder(metadata).settings(Settings.builder()
.put(metadata.getSettings()).put(
IndexMetadata.INDEX_DATA_PATH_SETTING.getKey(),
"/invalid/path")).build();
2024-09-26 11:52:17 +03:00
Kostas Krikellas fffe8844e9
Apply auto-flattening to `subobjects: auto` (#112092)
* Introduce mode `subobjects=auto` for objects

* Update docs/changelog/110524.yaml

* compilation error

* tests and fixes

* refactor

* spotless

* more tests

* fix nested objects

* fix test

* update fetch test

* add QA coverage

* update tests

* update tests

* update tests

* Apply auto-flattening to `subobjects: auto`

* Update docs/changelog/112092.yaml

* sync

* dont flatten subobjects auto

* refine test

* fix path for nested flattened objects and dynamic

* document `subobjects: auto`

* Apply suggestions from code review

Co-authored-by: Felix Barnsteiner <felixbarny@users.noreply.github.com>

* comment updates

* restore indentation in comment

* update comment

* update comment

* update comment

* update comment

* rename isFlattenable

* add test for dynamic template

* fix copy_to and noop dynamic updates

* tests

* update comment

* fix tests

* update cluster feature in yaml test

* address comments

---------

Co-authored-by: Felix Barnsteiner <felixbarny@users.noreply.github.com>
2024-09-26 11:42:40 +03:00
elasticsearchmachine 99015aa948 Mute org.elasticsearch.xpack.ml.integration.MlJobIT testCantCreateJobWithSameID #113581 2024-09-26 17:21:55 +10:00
David Turner 7bfb090c4c
Clean up persistent task APIs (#113523)
Removes unused mutability from request types and unnecessary subclasses
of `ActionType<>`.
2024-09-26 08:18:52 +01:00
David Turner 44a5ce3798
Expose `Connection` to remote clusters (#113453)
Sometimes we might need to invoke different requests on a remote cluster
depending on the version of the transport protocol it understands, but
today we cannot make that distinction (without starting to execute an
action on the remote cluster and failing while serializing the request
at least). This commit allows callers access to the underlying
`Transport.Connection` instance so that we can implement better BwC
logic.
2024-09-26 08:17:04 +01:00
Gergely Kalapos 55ef5e6ba1
Remove dynamic templates from otel-plugin that set `index:false` (#113409)
* Remove dynamic templates from otel-plugin that set `index:false`

* Update x-pack/plugin/otel-data/src/yamlRestTest/resources/rest-api-spec/test/20_metrics_tests.yml

Co-authored-by: Felix Barnsteiner <felixbarny@users.noreply.github.com>

* Remove unused dynamic templates

* Update metrics-otel@mappings.yaml

---------

Co-authored-by: Felix Barnsteiner <felixbarny@users.noreply.github.com>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2024-09-26 08:36:58 +02:00
elasticsearchmachine fb4ebfb03b Mute org.elasticsearch.xpack.inference.TextEmbeddingCrudIT testPutE5Small_withPlatformAgnosticVariant #113577 2024-09-26 16:34:03 +10:00
Carlos Delgado d19a9cc6f1
Fix release tests by checking QSTR function is registered (#113527) 2024-09-26 08:12:34 +02:00
Stanislav Malyshev 5e06092d5e
Improve DateTime error handling and add some bad date tests (#112723)
* Improve DateTime error handling and add some bad date tests
2024-09-25 15:55:30 -06:00
Oleksandr Kolomiiets 35fbbec46a
Fix synthetic source for flattened field when used with ignore_above (#113499) 2024-09-25 14:38:37 -07:00
Keith Massey cd950bb2fa
Adding component template substitutions to the simulate ingest API (#113276) 2024-09-25 15:30:22 -05:00
elasticsearchmachine 022a678df6 Mute org.elasticsearch.xpack.inference.TextEmbeddingCrudIT testPutE5WithTrainedModelAndInference #113565 2024-09-26 06:18:22 +10:00
Mayya Sharipova c18c531d72
Deprecate legacy params from range query (#113286)
Deprecate to, from, include_lower, include_upper range query params.
These params have been removed from our documentation in v. 0.90.4 (d6ecdecc19),
but did not got through deprecation cycle.

These params to be removed in v9.0.

Related to #81276

Closes #48538
2024-09-25 14:48:45 -04:00
Dan Rubinstein 437ce66200
Adding ChunkingSettings logic and enabling ChunkingSettings for OpenAI embedding endpoints (#112074)
* Adding ChunkingSettings logic and enabling ChunkingSettings for OpenAI embedding endpoints

* Cleaning up naming in ChunkingSettings logic

* Incrementing InferenceIndex version

* Removing DefaultChunkingSettings, cleaning up chunking settings class and related tests, add chunking strategy to inference index

* Adding check for up to date index mappings when creating an inference endpoint

* Fixing transport version conflict

* Adding validation for invalid chunking settings inputs and improving error messaging

* Reverting SystemIndexMappingUpdateService changes and adding error messaging on mixed cluster exception
2024-09-25 14:22:57 -04:00
David Turner d5abfcf865
Avoid implicit ML/transform master node timeouts (#113536)
Today in the ML and Transform plugins we use `null` for timeouts related
to persistent tasks, which means to use the implicit default timeout of
30s. As per #107984 we want to eliminate all such uses of the implicit
default timeout. This commit either moves to using the timeout from the
associated transport request, if available, or else makes it explicit
that we're using a hard-coded 30s timeout.
2024-09-26 04:13:40 +10:00
Max Hniebergall 43ec760e9a
[ML] Zone aware planner renaming & related refactoring (#111522)
* Renaming - code mentioned modelId but was actually deploymentId

* Documenting

* add a test case and more renaming

* Renaming & remove TODOs

* Update MlAutoscalingStats javadoc to match autoscaler comments

* precommit
2024-09-25 13:40:10 -04:00
Rene Groeschke 138e100d3b
Workaround packaging tests failures on debian10 (#113550)
This is a workaround until https://github.com/elastic/elasticsearch/issues/113549 is addressed
2024-09-25 19:34:11 +02:00
Liam Thompson 4f666310c7
[DOCS] Create Elasticsearch basics section, refactor quickstarts section (#112436)
Co-authored-by: shainaraskas <58563081+shainaraskas@users.noreply.github.com>
2024-09-25 17:30:01 +02:00
elasticsearchmachine 8e18d6e8a7 Mute org.elasticsearch.xpack.esql.qa.mixed.EsqlClientYamlIT test {p0=esql/70_locale/Date format with Italian locale} #113540 2024-09-26 01:22:47 +10:00
elasticsearchmachine 4ba0e526db Mute org.elasticsearch.xpack.esql.qa.mixed.EsqlClientYamlIT test {p0=esql/70_locale/Date format with default locale} #113539 2024-09-26 01:22:36 +10:00
elasticsearchmachine 5d3c224aa9 Mute org.elasticsearch.backwards.MixedClusterClientYamlTestSuiteIT test {p0=search/180_locale_dependent_mapping/Test Index and Search locale dependent mappings / dates} #113537 2024-09-26 00:48:49 +10:00
Ignacio Vera 6642f1ee86
Unumute test affected by https://github.com/elastic/elasticsearch/pull/113099 (#113533)
Those test were failing for a missing backport with the following error:

```
stack_trace":"java.io.IOException: Can't read unknown type [111]\n\tat org.elasticsearch.server@9.0.0-SNAPSHOT
```

The backport is done so we can just unmute them.

fixes https://github.com/elastic/elasticsearch/issues/113502 fixes
https://github.com/elastic/elasticsearch/issues/113497
2024-09-26 00:22:38 +10:00
elasticsearchmachine fce8e40470 Mute org.elasticsearch.xpack.esql.expression.function.fulltext.QueryStringFunctionTests org.elasticsearch.xpack.esql.expression.function.fulltext.QueryStringFunctionTests #113496 2024-09-25 23:55:19 +10:00
Armin Braun d2447c723f
Move field_caps parsers to test codebase (#113310)
The parsing logic is test only at this point, lets move it to tests
accordingly to keep the prod codebase a little smaller.
Also fixed a missing `static`.
2024-09-25 15:12:15 +02:00
David Turner 2380778bc1
Fix up comment in `PersistentTasksNodeService` (#113526)
The formatting of this comment was destroyed by spotless. This commit
fixes this.
2024-09-25 22:54:39 +10:00
David Kyle a34e9fc323
[ML] Remove the cluster state listener when the adaptive allocations service stops (#113524) 2024-09-25 13:27:06 +01:00
elasticsearchmachine 328f463f82 Mute org.elasticsearch.validation.DotPrefixClientYamlTestSuiteIT test {p0=dot_prefix/10_basic/Deprecated index template with a dot prefix index pattern} #113529 2024-09-25 22:26:14 +10:00
Armin Braun ab09759f38
Turn SortFieldAndFormat into a record (#113398)
It's in the title, prerequisite for https://github.com/elastic/elasticsearch/pull/113164
2024-09-25 14:25:48 +02:00
elasticsearchmachine 19b3d5f154 Mute org.elasticsearch.xpack.ml.integration.MlJobIT testCreateJobsWithIndexNameOption #113528 2024-09-25 22:17:34 +10:00
Smriti 0638d3977a
Update index-templates.asciidoc (#113461)
Adding `security_solution-*-*` in list of index nae to avoid the pattern collisions.
2024-09-25 13:55:17 +02:00
Ioana Tagirta a8d7f79070
Remove match command (#113383)
* Remove match command

* Remove assertMatchCommand

* Remove unused import
2024-09-25 13:21:05 +02:00
David Turner d268da3141
Assert `NodeClient` in client wrapper (#113515)
Some `getClientWrapper()` implementations return a wrapper that only
wraps `NodeClient` instances. In practice we _only_ wrap `NodeClient`
instances so this check is redundant, and in a recent investigation it
was confusing to readers. With this commit we assert that we're always
wrapping a `NodeClient`.
2024-09-25 20:19:39 +10:00
Nikolaj Volgushev 9bc4f1dba8
Unmute security ITs related to bulk authz failures (#113513)
A
[change](https://github.com/elastic/elasticsearch/pull/111865/files#diff-f35477bd1eef27ca0cfd9e94205799a6ff7f64e02a658e456051e400f08db061R1774-R1799)
in the `indexRandom` method resulted in test failures due to unexpected
switches to system user processing during bulk index creation calls. It
has since been
[reverted](https://github.com/elastic/elasticsearch/pull/113416), so
this PR unmutes the relevant tests. Will monitor for failures.

Resolves: https://github.com/elastic/elasticsearch/issues/113345
Resolves: https://github.com/elastic/elasticsearch/issues/113341
Resolves: https://github.com/elastic/elasticsearch/issues/113338
Resolves: https://github.com/elastic/elasticsearch/issues/113328
Resolves: https://github.com/elastic/elasticsearch/issues/113311
Resolves: https://github.com/elastic/elasticsearch/issues/113285
Resolves: https://github.com/elastic/elasticsearch/issues/113260
Resolves: https://github.com/elastic/elasticsearch/issues/113185
2024-09-25 20:15:58 +10:00
Panagiotis Bailis f53dbeb7b7
Extending catch clause in rewriteAndFetch (#112829) 2024-09-25 13:14:58 +03:00
Martijn van Groningen 5573898516
Add initial synthetic source fallback logic (#112994)
Add initial code required to fallback synthetic source mode to stored
source mode using an index settings provider.

Note that the final version relies on a new index setting  that
determines source mode, which is currently controlled by  `mode` mapping
attribute in `_source` meta field mapper. Additionally index modes
should not enforce synthetic source mode.
2024-09-25 20:01:09 +10:00
David Kyle 7a0f4ee56e
[ML] Limit in flight requests when indexing model download parts (#112992)
Restores the changes from #111684 which uses multiple streams to improve the
time to download and install the built in ml models. The first iteration has a problem
where the number of in-flight requests was not properly limited which is fixed here.
Additionally there are now circuit breaker checks on allocating the buffer used to 
store the model definition.
2024-09-25 10:10:06 +01:00
Mary Gouseti 3d7904bee3
Add template builder (#113444)
Since we are enriching the component templates with more entries such as
the data stream lifecycle and in the future the data stream options, we
add a template builder to help with the code, especially tests.

To highlight the value and prepare for the PRs that will add the data
stream options to the template we replace calls to the constructor with
all arguments by the builder: - when there are aguements with null
values, or - when we copy another template and change only a few fields.

This prepares the ground, so when we add data stream options, we will
not need to edit all these places.
2024-09-25 19:00:17 +10:00
Nick Tindall 8b31a775d6
Refactor/move backoff policy to common (#113500) 2024-09-25 17:23:16 +10:00
David Turner 97db0c2182
Remove `{Indices,}ClusterStateUpdateRequest` (#113483)
These abstract classes are now unused so this commit removes them.
2024-09-25 08:17:51 +01:00