Commit graph

489 commits

Author SHA1 Message Date
Martijn van Groningen
af53aadbaf
[8.18] Improve resiliency of UpdateTimeSeriesRangeService (#126680)
Backporting #126637 to 8.18 branch.

If updating the `index.time_series.end_time` fails for one data stream,
then UpdateTimeSeriesRangeService should continue updating this setting for other data streams.

The following error was observed in the wild:

```
[2025-04-07T08:50:39,698][WARN ][o.e.d.UpdateTimeSeriesRangeService] [node-01] failed to update tsdb data stream end times
java.lang.IllegalArgumentException: [index.time_series.end_time] requires [index.mode=time_series]
        at org.elasticsearch.index.IndexSettings$1.validate(IndexSettings.java:636) ~[elasticsearch-8.17.3.jar:?]
        at org.elasticsearch.index.IndexSettings$1.validate(IndexSettings.java:619) ~[elasticsearch-8.17.3.jar:?]
        at org.elasticsearch.common.settings.Setting.get(Setting.java:563) ~[elasticsearch-8.17.3.jar:?]
        at org.elasticsearch.common.settings.Setting.get(Setting.java:535) ~[elasticsearch-8.17.3.jar:?]
        at org.elasticsearch.datastreams.UpdateTimeSeriesRangeService.updateTimeSeriesTemporalRange(UpdateTimeSeriesRangeService.java:111) ~[?:?]
        at org.elasticsearch.datastreams.UpdateTimeSeriesRangeService$UpdateTimeSeriesExecutor.execute(UpdateTimeSeriesRangeService.java:210) ~[?:?]
        at org.elasticsearch.cluster.service.MasterService.innerExecuteTasks(MasterService.java:1075) ~[elasticsearch-8.17.3.jar:?]
        at org.elasticsearch.cluster.service.MasterService.executeTasks(MasterService.java:1038) ~[elasticsearch-8.17.3.jar:?]
        at org.elasticsearch.cluster.service.MasterService.executeAndPublishBatch(MasterService.java:245) ~[elasticsearch-8.17.3.jar:?]
        at org.elasticsearch.cluster.service.MasterService$BatchingTaskQueue$Processor.lambda$run$2(MasterService.java:1691) ~[elasticsearch-8.17.3.jar:?]
        at org.elasticsearch.action.ActionListener.run(ActionListener.java:452) ~[elasticsearch-8.17.3.jar:?]
        at org.elasticsearch.cluster.service.MasterService$BatchingTaskQueue$Processor.run(MasterService.java:1688) ~[elasticsearch-8.17.3.jar:?]
        at org.elasticsearch.cluster.service.MasterService$5.lambda$doRun$0(MasterService.java:1283) ~[elasticsearch-8.17.3.jar:?]
        at org.elasticsearch.action.ActionListener.run(ActionListener.java:452) ~[elasticsearch-8.17.3.jar:?]
        at org.elasticsearch.cluster.service.MasterService$5.doRun(MasterService.java:1262) ~[elasticsearch-8.17.3.jar:?]
        at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:1023) ~[elasticsearch-8.17.3.jar:?]
        at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:27) ~[elasticsearch-8.17.3.jar:?]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144) ~[?:?]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642) ~[?:?]
        at java.lang.Thread.run(Thread.java:1575) ~[?:?]
```

Which resulted in a situation, that causes the `index.time_series.end_time` index setting not being updated for any data stream. This then caused data loss as metrics couldn't be indexed, because no suitable backing index could be resolved:

```
the document timestamp [2025-03-26T15:26:10.000Z] is outside of ranges of currently writable indices [[2025-01-31T07:22:43.000Z,2025-02-15T07:24:06.000Z][2025-02-15T07:24:06.000Z,2025-03-02T07:34:07.000Z][2025-03-02T07:34:07.000Z,2025-03-10T12:45:37.000Z][2025-03-10T12:45:37.000Z,2025-03-10T14:30:37.000Z][2025-03-10T14:30:37.000Z,2025-03-25T12:50:40.000Z][2025-03-25T12:50:40.000Z,2025-03-25T14:35:40.000Z
```
2025-04-11 22:49:23 +10:00
John Verwolf
149f161896
[8.18] Bug Fix: System Data Streams Should Be Restorable (#124651) (#124912)
* Bug Fix: System Data Streams Should Be Restorable (#124651)

This PR adds a new MetadataDeleteDataStreamService that allows us to delete system data streams prior to a restore operation.  This fixes a bug where system data streams were previously un-restorable.

(cherry picked from commit cb3c35783b)

# Conflicts:
#	modules/data-streams/src/main/java/org/elasticsearch/datastreams/action/DeleteDataStreamTransportAction.java
#	server/src/main/java/org/elasticsearch/snapshots/RestoreService.java
#	server/src/test/java/org/elasticsearch/cluster/metadata/MetadataDataStreamsServiceTests.java

* Fix test bug, mute test
2025-03-15 09:21:05 +11:00
Alexey Ivanov
1077eacf94
System data streams are not being upgraded in the feature migration API (#123926) (#124750)
This commit adds support for system data streams reindexing. The system data stream migration extends the existing system indices migration task and uses the data stream reindex API.
The system index migration task starts a reindex data stream task and tracks its status every second. Only one system index or system data stream is migrated at a time. If a data stream migration fails, the entire system index migration task will also fail.
2025-03-14 02:06:02 +11:00
Rene Groeschke
378ae94c06
Update Gradle wrapper to 8.13 (#122421) (#123878)
* 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

(cherry picked from commit e19b2264af)

# Conflicts:
#	build-tools-internal/gradle/wrapper/gradle-wrapper.properties
#	build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/BaseInternalPluginBuildPlugin.java
#	build-tools-internal/src/main/resources/minimumGradleVersion
#	docs/build.gradle
#	gradle/wrapper/gradle-wrapper.properties
#	plugins/examples/gradle/wrapper/gradle-wrapper.properties
#	qa/lucene-index-compatibility/build.gradle
#	x-pack/qa/multi-project/core-rest-tests-with-multiple-projects/build.gradle
#	x-pack/qa/multi-project/xpack-rest-tests-with-multiple-projects/build.gradle
2025-03-05 15:57:38 +01:00
Keith Massey
0e42877c13
Updating TransportRolloverAction.checkBlock so that non-write-index blocks do not prevent data stream rollover (#122905) (#123068) 2025-02-21 07:30:06 +11:00
Jordan Powers
476286bf89
Copy metrics and default_metric properties when downsampling aggregate_metric_double (#121727) (#121853)
Fixes #119696 and #96076
2025-02-06 11:46:26 +11:00
Ryan Ernst
3537349096
Rename environment dir accessors (#121803) (#121836)
* Rename environment dir accessors (#121803)

The node environment has many paths. The accessors for these currently use a "file" suffix, but they are always directories. This commit renames the accessors to make it clear these paths are directories.

* [CI] Auto commit changes from spotless

---------

Co-authored-by: elasticsearchmachine <infra-root+elasticsearchmachine@elastic.co>
2025-02-06 10:28:25 +11:00
Slobodan Adamović
d11c3b5dfb
Disable queryable built-in roles feature for core and datastream YAML tests (#121541) (#121664)
This PR disables the "queryable built-in roles" feature for the `CoreWithSecurityClientYamlTestSuiteIT` and `DataStreamsClientYamlTestSuiteIT` YAML test suites.
The feature was enabled by default in the #120323 PR, which asynchronously creates the `.security` index after cluster formation and indexes all built-in roles. The asynchronous creation of the `.security` index introduces non-deterministic behavior in our YAML tests.
Since these test suites are not intended to verify the queryable built-in roles functionality, having the feature enabled introduced flakiness and unnecessary complexity to handle `.security` in existing tests. These tests would have to exclude the `.security` index in some way (by adjusting permissions or API calls), and in the end cleanup (delete) the `.security` index. This simply adds overhead without much gain. The feature is already test covered by `XPackRestIT` and other integration/REST tests, disabling it here would not compromise test coverage. Instead, it ensures these suites remain deterministic and focused on the behaviors they were designed to verify.

Resolves https://github.com/elastic/elasticsearch/issues/121536
Resolves https://github.com/elastic/elasticsearch/issues/121513
Resolves https://github.com/elastic/elasticsearch/issues/121484
Resolves https://github.com/elastic/elasticsearch/issues/121478
Resolves https://github.com/elastic/elasticsearch/issues/121290
Resolves https://github.com/elastic/elasticsearch/issues/121246
Resolves https://github.com/elastic/elasticsearch/issues/121242
Resolves https://github.com/elastic/elasticsearch/issues/121238
Resolves https://github.com/elastic/elasticsearch/issues/121186
Resolves https://github.com/elastic/elasticsearch/issues/121131
Resolves https://github.com/elastic/elasticsearch/issues/121130
Resolves https://github.com/elastic/elasticsearch/issues/121128
Resolves https://github.com/elastic/elasticsearch/issues/121014
Resolves https://github.com/elastic/elasticsearch/issues/120965
Resolves https://github.com/elastic/elasticsearch/issues/120920
Resolves https://github.com/elastic/elasticsearch/issues/120890

(cherry picked from commit d1beb01d27)

# Conflicts:
#	muted-tests.yml
2025-02-05 02:08:18 +11:00
Dimitris Rempapis
61f5b01200
[8.x] Test/107515 RestoreTemplateWithMatchOnlyTextMapperIT (#120898)
This is a manual backport of #120392 to 8.x
2025-01-30 02:01:21 +11:00
Nhat Nguyen
b79412f152
Allow unmapped fields in MultiClustersIT tests (#120873) (#120924)
The message_id field may be unmapped if documents were indexed into some 
indices but not all. This change specifies the unmapped type for
message_id, allowing it to be sorted in such cases.

Closes #120796
2025-01-29 13:32:19 +11:00
Mary Gouseti
9eccda25ad
[Bug] Data stream stats fails when there is a concrete index in the cluster (#120901) (#120921) 2025-01-28 19:11:08 +11:00
Slobodan Adamović
7245c05a44
[8.x] Enable queryable built-in roles feature by default (#120323) (#120886)
* Enable queryable built-in roles feature by default (#120323)

Making the `es.queryable_built_in_roles_enabled` feature flag enabled by default.
This feature makes the built-in roles automatically indexed in `.security` index and available
for querying via Query Role API. The consequence of this is that `.security` index is now
created eagerly (if it's not existing) on cluster formation.

In order to keep the scope of this PR small, the feature is disabled for some of the tests,
because they are either non-trivial to adjust or the gain is not worthy the effort to do it now.
The tests will be adjusted in a follow-up PR and later the flag will be removed completely.

Relates to #117581

(cherry picked from commit 52e0f21bdd)

# Conflicts:
#	modules/dot-prefix-validation/build.gradle
#	test/framework/src/main/java/org/elasticsearch/test/InternalTestCluster.java
#	x-pack/plugin/security/src/internalClusterTest/java/org/elasticsearch/xpack/security/authc/esnative/ReservedRealmElasticAutoconfigIntegTests.java

* Update InternalTestCluster.java

remove line snuck after resolving merge confilcs

* Update build.gradle

fix build.gradle

* Update build.gradle

fix build.gradle by removing invalid task

* remove non-existing timeout parameter on 8.x branch
2025-01-27 23:40:15 +11:00
Mary Gouseti
7b2afeea1f
Failure store - No selectors in snapshots (#120114) (#120711)
In this PR we include the failure store indices while
disallowing the user to use selectors in the `indices` field of the
create and restore snapshot requests.

**Security concerns**

The create and restore snapshot require cluster privileges only, so we
do not have to worry about how to handle index level security (see
[Create Snapshot
API](https://www.elastic.co/guide/en/elasticsearch/reference/current/create-snapshot-api.html#create-snapshot-api-prereqs)
& [Restore Snapshot
API](https://www.elastic.co/guide/en/elasticsearch/reference/current/restore-snapshot-api.html#restore-snapshot-api-prereqs)).

**Challenges**

While there are other APIs that do not support selectors but they do
include the failure indices in their response such as `GET
_data_stream/<target>`, `GET _data_stream/<target>/stats`, etc; the
snapshot APIs are a little bit different. The reason for that is that
the data stream APIs first collect only the relevant data streams and
then they select the backing indices and/or the failure indices. On the
other hand, the snapshot API that works with both indices and data
streams cannot take such a shortcut and needs to use the
`concreteIndices` method.

We propose, to add a flag that when the selectors are not "allowed" can
determine if we need to include the failure store or not. In the past we
had something similar called the default selector, but it was more
flexible and it was used a fallback always.

Our goal now is to only specify the behaviour we want when the selectors
are not supported. This new flag allowed also to simplify the concrete
index resolution in `GET _data_stream/<target>/stats`

Relates to #119545
2025-01-24 01:55:28 +11:00
Simon Cooper
77a179706d
[8.x] Remove IndexNameExpressionResolver from base classes that don't use it (#120531) (#120599)
Backport #120531 to 8.x
2025-01-22 12:30:07 +00:00
Mary Gouseti
7f0a8d96c8
[Failure store] Add failure index retrieval to IndexAbstraction (#119413) (#120358) 2025-01-20 21:02:54 +11:00
James Baiera
dcb139424d
[8.x] Add selector syntax to index expressions (#118614) (#119832)
* Add selector syntax to index expressions (#118614)

This PR introduces a new syntactical feature to index expression resolution: The selector.

Selectors, denoted with a :: followed by a recognized suffix will allow users to specify which component of
an index abstraction they would like to operate on within an API call. In this case, an index abstraction is a
concrete index, data stream, or alias; Any abstraction that can be resolved to a set of indices/shards. We
define a component of an index abstraction to be some searchable unit of the index abstraction.

(cherry picked from commit c3839e1f76)

# Conflicts:
#	modules/data-streams/src/internalClusterTest/java/org/elasticsearch/datastreams/IngestFailureStoreMetricsIT.java
#	server/src/main/java/org/elasticsearch/TransportVersions.java
#	server/src/test/java/org/elasticsearch/action/OriginalIndicesTests.java

* [CI] Auto commit changes from spotless

* Fixing compiler issues

* Remove feature flag from influencing the serialisation

* Only add failure indices when failure store flag is on

* Fix OriginalIndicesTests

* [CI] Auto commit changes from spotless

---------

Co-authored-by: elasticsearchmachine <infra-root+elasticsearchmachine@elastic.co>
Co-authored-by: Felix Barnsteiner <felixbarny@users.noreply.github.com>
Co-authored-by: Mary Gouseti <mary.gouseti@elastic.co>
Co-authored-by: Mary Gouseti <mgouseti@gmail.com>
2025-01-10 17:39:43 -05:00
Simon Cooper
d18ce7d84f
[8.18] Mark all features added before 8.18 as assumed (#119056)
8.x edition of #119055 to mark features to be removed in 9.0 as assumed
2025-01-09 16:58:31 +00:00
Albert Zaharovits
a5811d05f6
[8.x] Metrics for indexing failures due to version conflicts (#119067) (#119761)
* Metrics for indexing failures due to version conflicts (#119067)

This exposes new OTel node and index based metrics for indexing failures due to version conflicts.

In addition, the /_cat/shards, /_cat/indices and /_cat/nodes APIs also expose the same metric, under the newly added column iifvc.

Relates: #107601
(cherry picked from commit 12eb1cfda1)

# Conflicts:
#	server/src/main/java/org/elasticsearch/TransportVersions.java

* types

* Fix NodeIndexingMetricsIT

* [CI] Auto commit changes from spotless

* Fix RestShardsActionTests

* Fix test/cat.shards/10_basic.yml for bwc

---------

Co-authored-by: elasticsearchmachine <infra-root+elasticsearchmachine@elastic.co>
2025-01-10 02:25:57 +11:00
Rene Groeschke
6b7cd0339e
Update Gradle wrapper to 8.12 (#118683) (#119363)
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

(cherry picked from commit ba61f8c7f7)
2024-12-31 08:36:31 +01:00
Pete Gillin
013f36384c
[8.x] Add cluster setting to enable failure store (#118662) (#119132)
This setting enables or disables the failure store for data streams
based on matching the data stream name against a list of patterns. It
acts as a default, and is overridden if the failure store is
explicitly enabled or disabled either in a component template or using
the data stream options API.

(See the PR for explanations of some of the changes here.)

(cherry picked from commit 97e6bb6ce3)

# Conflicts:
#	server/src/main/java/org/elasticsearch/action/bulk/BulkOperation.java
#	server/src/main/java/org/elasticsearch/node/NodeConstruction.java
2024-12-23 09:19:53 +00:00
Mary Gouseti
0103a97e80
[8.x] Failure store - Reconciliate failure indices during snapshotting (#118834) (#119077)
In this PR we reconciliate the failure indices of a data stream just like we do for the backing indices. The only difference is that a data stream can have an empty list of failure indices, while it cannot have an empty list of backing indices.

An easy way to create a situation where certain backing or failure indices are not included in a snapshot is via using exclusions in the multi-target expression of the snapshot. For example:
```
PUT /_snapshot/my_repository/my-snapshot?wait_for_completion=true
{
  "indices": "my-ds*", "-.fs-my-ds-000001"
}
```

Backport of #118834
2024-12-20 02:35:04 +11:00
Mary Gouseti
aa86b52aa8
Introduce data stream options via dedicated classes (backport #117357) (#118313)
In this PR we move the failure store configuration from the
`data_stream` in a composable index template to the `template` section
under the `data_stream_options`. The reason for this change is that we
want to be able to compose the failure store configuration via component
templates.

**Previous composable index template**

```
{
  "index_patterns": [....],
  "template": {
      ......
  },
  "data_stream": {
    "failure_store": true
  }
}
```

**New composable index template**

```
{
  "index_patterns": [....],
  "template": {
      "data_stream_options": {
        "failure_store": {
          "enabled": true
        }
      },
      ......
  },
  "data_stream": {}
}
```

**Composition logic**

| Component Template A | Composable Index Template | Resolved data
stream options |
|-------------------------|-----------------------------|-------------------------------|
| `{"failure_store": {"enabled": true}}` | - |`{"failure_store":
{"enabled": true}}`| | `{"failure_store": {"enabled": true}}` |
`{"failure_store": {"enabled": false}}` |`{"failure_store": {"enabled":
false}}`| | - | `{"failure_store": {"enabled": true}}`
|`{"failure_store": {"enabled": true}}`| | `{"failure_store": null}` |
`{"failure_store": {"enabled": true}}` |`{"failure_store": {"enabled":
true}}`| | `{"failure_store": {"enabled": true}}` | `{"failure_store":
null}` |`{}`|

More context and discussions can be found in the comments of
#113863.
2024-12-10 14:19:00 +02:00
Matteo Piergiovanni
fa7ac36f9c
[8.x] Only aggregations require at least one shard request (#115314) (#115794)
* Only aggregations require at least one shard request (#115314)

* unskipping shards only when aggs

* Update docs/changelog/115314.yaml

* fixed more tests

* null check for searchRequest.source()

(cherry picked from commit 7f573c6c28)

* applying #115774

* skipped test

* fixed test

---------

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2024-12-05 10:32:26 +01:00
Nhat Nguyen
4230d72c22
Acquire stats searcher for data stream stats (#117953) (#118006)
Here, we only need to extract the minimum and maximum values of the 
timestamp field; therefore, using a stats searcher should suffice. This
is important for frozen indices.
2024-12-05 03:42:34 +11:00
Keith Massey
70da167e52
Moving the data stream reindex task to x-pack (#117927) (#117936) 2024-12-05 03:20:05 +11:00
Keith Massey
232bfe1a6a
Removing unnecessary state from DataStreamReindexTask (#117942) (#117988) 2024-12-05 01:56:47 +11:00
Nhat Nguyen
bfdde9bc76
Deprecate source mode in mappings (#117177)
Backport of #116689 to 8.18
2024-11-25 15:16:29 -08:00
Rene Groeschke
617644f781
[8.x] [Gradle] Remove static use of BuildParams (#115122) (#117436)
* [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

(cherry picked from commit 13c8aaeffa)

# Conflicts:
#	TESTING.asciidoc
#	build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/test/rest/RestTestBasePlugin.java
#	build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/test/rest/compat/compat/AbstractYamlRestCompatTestPlugin.java
#	build.gradle
#	modules/ingest-geoip/qa/full-cluster-restart/build.gradle
#	qa/mixed-cluster/build.gradle
#	x-pack/plugin/ent-search/qa/full-cluster-restart/build.gradle
#	x-pack/plugin/eql/qa/rest/build.gradle
#	x-pack/plugin/fleet/qa/rest/build.gradle
#	x-pack/plugin/kql/build.gradle
#	x-pack/plugin/mapper-unsigned-long/build.gradle
#	x-pack/plugin/ml/qa/multi-cluster-tests-with-security/build.gradle
#	x-pack/plugin/security/qa/multi-cluster/build.gradle
#	x-pack/plugin/sql/qa/jdbc/build.gradle
#	x-pack/plugin/transform/qa/multi-cluster-tests-with-security/build.gradle

* fix merge issue

* Fix more merge conflicts

* Fix merge conflicts

* Update TESTING.asciidoc
2024-11-25 18:28:51 +01:00
Nhat Nguyen
7f461f44e8
[8.x] Add CCS tests for logsdb (#113658) (#113691)
* Add CCS tests for logsdb (#113658)

Closes #109805

* compile
2024-11-25 14:24:36 +11:00
Keith Massey
76a06ca9ee
Reindex data stream persistent task (#116780) (#117251) 2024-11-24 13:34:37 -06:00
Simon Cooper
da604f2ab6
Fix invalid timestamps in TSDB yaml test (#116708) 2024-11-13 10:09:33 +00:00
Kostas Krikellas
003bea2035
[TEST] Run tsdb tests with both base and trial licenses (#115653) (#115851)
* Run tsdb tests with both base and trial licenses.

* ignore license error in serverless

* update

* update

* update

(cherry picked from commit b97b6637a6)
2024-10-30 03:38:37 +11:00
Mary Gouseti
58ff29e656
[Failure store - selector syntax] Introduce the ::* selector (#115389) (#115507)
**Introduction**

> In order to make adoption of failure stores simpler for all users, we
are introducing a new syntactical feature to index expression
resolution: The selector. > > Selectors, denoted with a :: followed by a
recognized suffix will allow users to specify which component of an
index abstraction they would like to operate on within an API call. In
this case, an index abstraction is a concrete index, data stream, or
alias; Any abstraction that can be resolved to a set of indices/shards.
We define a component of an index abstraction to be some searchable unit
of the index abstraction. > > To start, we will support two components:
data and failures. Concrete indices are their own data components, while
the data component for index aliases are all of the indices contained
therein. For data streams, the data component corresponds to their
backing indices. Data stream aliases mirror this, treating all backing
indices of the data streams they correspond to as their data component.
>  > The failure component is only supported by data streams and data
stream aliases. The failure component of these abstractions refer to the
data streams' failure stores. Indices and index aliases do not have a
failure component.

For more details and examples see
https://github.com/elastic/elasticsearch/pull/113144. All this work has
been cherry picked from there.

**Purpose of this PR**

This PR is introducing the `::*` as another selector option and not as a
combination of `::data` and `::failure`. The reason for this change is
that we need to differentiate between:

- `my-index::*` which should resolve to `my-index::data` only and not to `my-index::failures` and
- a user explicitly requesting `my-index::data, my-index::failures` which should result potentially to an error.
2024-10-24 21:03:15 +11:00
Mary Gouseti
21312daadf
Adjust failure store to work with TSDS (#114307) (#115294)
In this PR we add a test and we fix the issues we encountered when we
enabled the failure store for TSDS and logsdb.

**Logsdb** Logsdb worked out of the box, so we just added the test that
indexes with a bulk request a couple of documents and tests how they are
ingested.

**TSDS** Here it was a bit trickier. We encountered the following
issues:

- TSDS requires a timestamp to determine the write index of the data stream meaning the failure happens earlier than we have anticipated so far. We added a special exception to detect this case and we treat it accordingly.
- The template of a TSDS data stream sets certain settings that we do not want to have in the failure store index. We added an allowlist that gets applied before we add the necessary index settings. 

Furthermore, we added a test case to capture this.
2024-10-22 19:45:24 +11:00
Kostas Krikellas
075a40aecb
SyntheticSourceIndexSettingsProvider restores stored source (#114978) (#115187)
* SyntheticSourceIndexSettingsProvider restores stored source

* remove asserts

* add and fix tests

* fix test

* more tests

* fix assert

* remove assert

(cherry picked from commit 5645240976)
2024-10-21 13:53:53 +03:00
Mary Gouseti
3b2cfae8b9
Replace IntermittentLongGCDisruption with blocking cluster state updates (#115075) (#115086)
In JDK 23 `Thread.resume` has been removed this means that we cannot use
`IntermittentLongGCDisruption` that depends on it. 

We simulate the master node disruption with a `CyclicBarrier` that
blocks cluster state updates.

Closes: https://github.com/elastic/elasticsearch/issues/115045

The backport will close:
https://github.com/elastic/elasticsearch/issues/112634

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2024-10-21 19:22:09 +11:00
Oleksandr Kolomiiets
1d8c61f11e
Move logsdb tests to logsdb plugin (#114952) (#115034) 2024-10-17 12:46:12 -07:00
Oleksandr Kolomiiets
e53f30177f
[8.x] Make mapping a distinct concept in logsdb data generation (#114370) (#114868)
* Make mapping a distinct concept in logsdb data generation (#114370)

* fix compilation
2024-10-17 07:44:24 +11:00
Mary Gouseti
6de48b122f
[Failure store - selector syntax] Replace failureOptions with selector options internally. (#114812) (#114882)
**Introduction**

> In order to make adoption of failure stores simpler for all users, we
are introducing a new syntactical feature to index expression
resolution: The selector. > > Selectors, denoted with a :: followed by a
recognized suffix will allow users to specify which component of an
index abstraction they would like to operate on within an API call. In
this case, an index abstraction is a concrete index, data stream, or
alias; Any abstraction that can be resolved to a set of indices/shards.
We define a component of an index abstraction to be some searchable unit
of the index abstraction. > > To start, we will support two components:
data and failures. Concrete indices are their own data components, while
the data component for index aliases are all of the indices contained
therein. For data streams, the data component corresponds to their
backing indices. Data stream aliases mirror this, treating all backing
indices of the data streams they correspond to as their data component.
>  > The failure component is only supported by data streams and data
stream aliases. The failure component of these abstractions refer to the
data streams' failure stores. Indices and index aliases do not have a
failure component.

For more details and examples see
https://github.com/elastic/elasticsearch/pull/113144. All this work has
been cherry picked from there.

**Purpose of this PR**

This PR is replacing the `FailureStoreOptions` with the
`SelectorOptions`, there shouldn't be any perceivable change to the user
since we kept the query parameter "failure_store" for now. It will be
removed in the next PR which will introduce the parsing of the
expressions. 

_The current PR is just a refactoring and does not and should not change
any existing behaviour._
2024-10-16 20:27:25 +11:00
Oleksandr Kolomiiets
17022fdefc
[8.x] Allow stored source in logsdb and tsdb (#114454) (#114648)
* Allow stored source in logsdb and tsdb (#114454)

(cherry picked from commit a62228a744)

# Conflicts:
#	modules/aggregations/build.gradle
#	modules/data-streams/src/javaRestTest/java/org/elasticsearch/datastreams/logsdb/LogsIndexModeCustomSettingsIT.java
#	rest-api-spec/build.gradle

* Fix tests

* Fix tests

---------

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2024-10-15 12:07:27 -07:00
Martijn van Groningen
8b6ae3cdba
Update IndexSettingProvider#getAdditionalIndexSettings() signature (#114150) (#114724)
With logsdb another index mode is available, the isTimeSeries parameter is limiting. Instead, we should just push down the index mode from template to index settings provider.

Follow up from #113451
Relates to #113583
2024-10-15 02:39:23 +11:00
Mary Gouseti
04bc70c84c
Introduce CRUD APIs for data stream options (#113945) (#114718)
In this PR we introduce two endpoint PUT and GET to manage the data
stream options and consequently the failure store configuration on the
data stream level. This means that we can manage the failure store of
existing data streams.

The APIs look like:

```
# Enable/disable 
PUT _data_stream/my-data-stream/_options
{
  "failure_store": {
    "enabled": true
  }
}

# Remove existing configuration
DELETE _data_stream/my-data-stream/_options

# Retrieve 
GET _data_stream/my-data-stream/_options
{
  "failure_store": {
    "enabled": true
  }
}
```

Future work:

- Document the new APIs
- Convert `DataStreamOptionsIT.java` to a yaml test.
2024-10-15 01:15:32 +11:00
Oleksandr Kolomiiets
006c274824
Remove cluster.logsdb.enabled from StackPlugin (#113616) (#114664)
After introducing #113505 we need to remove `cluster.logsdb.enabled` from
`StackPlugin` and `StackTemplateRegistry`.

(cherry picked from commit 487c5562aa)

Co-authored-by: Salvatore Campagna <93581129+salvatore-campagna@users.noreply.github.com>
2024-10-11 17:42:26 -07:00
Mary Gouseti
feec6c7bfb
[Failure store - selector syntax] Refactor IndicesOptions builder (#114597) (#114622)
**Introduction**

> In order to make adoption of failure stores simpler for all users, we
are introducing a new syntactical feature to index expression
resolution: The selector. > > Selectors, denoted with a :: followed by a
recognized suffix will allow users to specify which component of an
index abstraction they would like to operate on within an API call. In
this case, an index abstraction is a concrete index, data stream, or
alias; Any abstraction that can be resolved to a set of indices/shards.
We define a component of an index abstraction to be some searchable unit
of the index abstraction. > > To start, we will support two components:
data and failures. Concrete indices are their own data components, while
the data component for index aliases are all of the indices contained
therein. For data streams, the data component corresponds to their
backing indices. Data stream aliases mirror this, treating all backing
indices of the data streams they correspond to as their data component.
>  > The failure component is only supported by data streams and data
stream aliases. The failure component of these abstractions refer to the
data streams' failure stores. Indices and index aliases do not have a
failure component.

For more details and examples see
https://github.com/elastic/elasticsearch/pull/113144. All this work has
been cherry picked from there.

**Purpose of this PR**

This PR is replacing the the indices options boolean constructor with
the builders. The goal is to give me and the reviewer a very narrow
scope change when we can ensure we did not make any mistakes during the
conversion. Also it will reduce a bit the change list in
https://github.com/elastic/elasticsearch/pull/113144/files.
2024-10-12 01:47:17 +11:00
Kostas Krikellas
14ba77f21d
[TEST] Add coverage for field caps and ES|QL to LogsDB QA testing (#114505) (#114562)
* Add coverage for field caps and ES|QL to LogsDB QA testing

* address comments

* address comments

* address comments

(cherry picked from commit 34da953571)
2024-10-11 17:14:08 +11:00
Mary Gouseti
5b3625d849
Clean up factory retention settings from elasticsearch (#114396) (#114485)
This removes the possibility for a plugin to provide factory retention settings. Factory retention settings have been deprecated and completely replaced by #111972.

Note: this feature is not in use. If someone wants to set global retention they can use the cluster settings as defined in #111972.
2024-10-10 20:57:58 +11:00
Oleksandr Kolomiiets
eeec634cff
Correctly inject subobjects parameter in logsdb tests (#113643) (#114178) 2024-10-07 09:52:42 -07:00
David Turner
5a5b14dde6
[8.x] Assert that REST params are consumed iff supported (#114040) (#114087)
* Assert that REST params are consumed iff supported (#114040)

REST APIs which declare their supported parameters must consume exactly
those parameters: consuming an unsupported parameter means that requests
including that parameter will be rejected, whereas failing to consume a
supported parameter means that this parameter has no effect and should
be removed.

This commit adds an assertion to verify that we are consuming the
correct parameters.

Closes #113854

* CI poke
2024-10-04 23:32:25 +10:00
David Turner
f1113f5712
Ensure that supported params are computed once (#113980)
* Ensure that supported params are computed once

A few of today's REST handler implementations compute a new set of
supported parameters on each request. This is needlessly inefficient
since the set never changes. This commit fixes those implementations and
adds assertions to verify that we are returning the exact same instance
each time.

Backport of #113953 to `8.x`

* Fix
2024-10-03 20:54:38 +10:00
Gergely Kalapos
bb0a9f438b
Make xpack.otel_data.registry.enabled default to true (#113468) (#113871)
* Make xpack.otel_data.registry.enabled default to true

* Update build.gradle

* Disable otel-data plugin for tests where it's not relevant

---------

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2024-10-02 01:30:51 +10:00