Commit graph

193 commits

Author SHA1 Message Date
Mary Gouseti
b9917086e1
Create dedicated factory methods for data lifecycle (#126487)
The class `DataStreamLifecycle` is currently capturing the lifecycle
configuration that currently manages all data stream indices, but soon
enough it will be split into two variants, the data and the failures
lifecycle. 

Some pre-work has been done already but as we are progressing in our
POC, we see that it will be really useful if the `DataStreamLifecycle`
is "aware" of the target index component. This will allow us to
correctly apply global retention or to throw an error if a downsampling
configuration is provided to a failure lifecycle.

In this PR, we perform a small refactoring to reduce the noise in
https://github.com/elastic/elasticsearch/pull/125658. Here we introduce
the following:

- A factory method that creates a data lifecycle, for now it's trivial but it will be more useful soon.
- We rename the "empty" builder to explicitly mention the index component it refers to.
2025-04-23 20:00:25 +10:00
Mary Gouseti
e461717627
Test fix: align timeouts in testDataStreamLifecycleDownsampleRollingRestart (#123769) (#126682)
Recently we changed the implementation of
`testDataStreamLifecycleDownsampleRollingRestart` to use a temporary
state listener. We missed that the listener also had a timeout that was
quite shorter than the `safeGet` timeout we were configuring. In this PR
we align these two timeouts.

Fixes: #123769
2025-04-15 02:53:59 +10:00
David Turner
800cf72e1f
Use TimeValue for timeouts in safeAwait etc. (#126509)
There's no need to force callers to deconstruct the `TimeValue` in their
possession into a `long` and a `TimeUnit`, we can do it ourselves.
2025-04-12 02:46:28 +10:00
Niels Bauman
507f40cd72
Fix ILMDownsampleDisruptionIT.testILMDownsampleRollingRestart (#126692)
Wait for the index to exist on the master node to ensure all nodes have
the latest cluster state.

Fixes #126495
2025-04-11 17:45:45 +02:00
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
Mary Gouseti
1943844d5a
Effort to fix testDataStreamLifecycleDownsampleRollingRestart #123769 (#125478) 2025-03-28 15:26:09 +02:00
Mary Gouseti
2c377f9c85
Unify template builders for data stream options, failure store and data stream lifecycle (#125293) 2025-03-21 10:03:27 +02:00
Nikolaj Volgushev
c58ac456b8
Failure Store Access Authorization (#123986)
This PR implements authorization logic for failure store access. It
builds on https://github.com/elastic/elasticsearch/pull/122715.

Access to the failure store is granted by two privileges:
`read_failure_store` and `manage_failure_store`. Either of these
privileges lets a user access a failure store via the `::failures`
selector, as well as access its backing failure indices. 
`read_failure_store` grants read access (for example to search documents
in a failure store), `manage_failure_store` grants access to write
operations, such as rollover. Users with only `read` or `manage` on a
data stream do not get failure store access. Vice versa, users with
`read_failure_store` and `manage_failure_store` do not get access to
regular data in a data stream. 

The PR implements this by making authorization logic selector-aware. It
involves two main changes:

1. Index permission groups now compare the selector under which an index resource is accessed to the selector associated with the group.
2. The `AuthorizedIndices` interface likewise uses selectors to decide which indices to treat as authorized. This part of the change requires a sizable refactor and changes to the interface. 

The high-level behavior for selector-aware search is as follows:

For a user with `read_failure_store` over data stream `logs`:

- `POST /logs::failures/_search` returns the documents in the failure store.
- `POST /logs/_search` returns a 403.
- `POST /logs/_search?ignore_unavailable=true` and `POST /*/_search` return an empty result.

Similarly, for a user with `read` over data stream `logs`:

- `POST /logs::failures/_search` returns a 403.
- `POST /logs/_search` returns documents in the data stream.
- `POST /logs::failures/_search?ignore_unavailable=true` and `POST /*::failures/_search` return an empty result.

A user with both `read` and `read_failure_store` over data stream `logs`
gets access to both `POST /logs::failures/_search` and `POST
/logs/_search`.

The index privilege `all` automatically grants access to both data and
the failures store, as well as all hypothetical future selectors. 

Resolves: ES-10873
2025-03-20 20:10:16 +11:00
Martijn van Groningen
ae16016290
Update disable assertion jvm args from bwc/mixed cluster setups. (#125074)
Remove `-da:org.elasticsearch.index.mapper.DocumentMapper` and `-da:org.elasticsearch.index.mapper.MapperService` from mixed cluster/bwc cluster setups. Given that #122606 is now backported to the 8.18 branch.
2025-03-19 08:10:50 +01:00
Mary Gouseti
ce04da7dea
Refactor data stream lifecycle to use the template paradigm (#124593) 2025-03-18 13:24:06 +02:00
Rene Groeschke
ae569def9c
[Build] Require reason for usesDefaultDistribution (#124707)
This makes using usesDefaultDistribution in our test setup for explicit by requiring a reason why it's needed.
This is helpful as part of revisiting the need for all those usages in our code base.
2025-03-17 08:25:39 +01:00
Martijn van Groningen
5bbc04bc66
Cleanup assert in DownsampleShardIndexer (#124751) 2025-03-13 18:07:59 +01:00
Martijn van Groningen
d81c7995a7
Improve rolling up metrics (#124739)
Remove unneeded Metric abstraction in MetricFieldProducer, which speeds-up rolling up gauges/counters.
2025-03-13 14:54:12 +00:00
Martijn van Groningen
81f33e4602
Change downsample's MetricFieldProducers (#124701)
Refactor MetricFieldProducer to use SortedNumericDoubleValues instead of FormattedDocValues, which saves unneeded conversations / casts.
2025-03-13 11:59:46 +00:00
Martijn van Groningen
ce3a778fa1
Improve downsample performance by buffering docids and do bulk processing. (#124477) 2025-03-13 07:46:08 +01:00
Martijn van Groningen
58d80f36a3
Improve DownsampleActionSingleNodeTests testing (#124550)
By indexing the test data set in multiple bulk requests, which ensure there are multiple segments, which improves testing coverage for DownsampleShardIndexer.

We don't catch more complex DownsampleShardIndexer issues if we end up with just one segment. Hence, we need to make the DownsampleShardIndexer test suite a little bit more evil by ensuring we have more than one segment.
2025-03-11 13:05:43 +01:00
Martijn van Groningen
6afd3ecc58
Avoid reading unnecessary dimension values when downsampling (#124451)
Read dimension values once per tsid/bucket docid range instead of for each document being processed.
The dimension value within a bucket-interval docid range is always to same and this avoids unnecessary reads.

Latency of downsampling the tsdb track index into a 1 hour interval downsample index drop by ~16% (running on my local machine).
2025-03-10 12:12:42 +01:00
Niels Bauman
2a7eb6e117
Make downsampling project-aware (#124000)
Allows downsampling to work on multiple projects.
2025-03-06 12:55:04 +01:00
Martijn van Groningen
ea8283e9c8
Avoid serializing empty _source fields in mappings. (#122606) 2025-03-06 12:20:07 +01:00
Tim Vernum
77bf65d9af Merge main into multi-project 2025-02-25 10:33:53 +11: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
Tim Vernum
5b2f1cbdaa Merge revision 1c368c7d42 into multi-project 2025-02-19 21:37:04 +11:00
Niels Bauman
1c368c7d42
Remove trappy timeouts from GetSettingsRequest (#122855)
Relates #107984
2025-02-19 09:03:52 +01:00
Tim Vernum
838d8389de Merge main into multi-project 2025-02-19 16:40:34 +11:00
Salvatore Campagna
7f7967bcfa
Remove TransportDownsampleIndexerAction (#122756) 2025-02-18 12:32:20 +01:00
Tim Vernum
680e7a6979 Merge revision 5c00341c2b into multi-project 2025-02-14 17:17:41 +11:00
Kostas Krikellas
65f6b44b2a
Handle error in concurrent downsample actions (#122251) 2025-02-12 15:07:38 +02:00
Yang Wang
04d459009b Merge main into multi-project 2025-02-12 09:57:09 +11:00
Niels Bauman
0ec2fe05ef
Increase timeout in DataStreamLifecycleDownsampleDisruptionIT (#122151)
The downsample task sometimes needs a little bit longer to complete so
we bump the timeout from 60s to 120s.

Fixes #122056
2025-02-10 17:01:27 +10:00
Yang Wang
b4d60b0c01 Merge main into multi-project 2025-02-06 14:15:37 +11:00
Jordan Powers
e3e474c337
Copy metrics and default_metric properties when downsampling aggregate_metric_double (#121727)
Fixes #119696 and #96076
2025-02-06 00:32:14 +01:00
Yang Wang
38d74f7408 Merge main into multi-project 2025-02-06 10:04:49 +11:00
Armin Braun
229d89d343
Remove GroupShardsIterator and replace it with plain List (#116891)
There is no point in having `GroupShardsIterator`, it's mostly an
unnecessary layer of indirection as it has no state and a single field
only. It's only value could be seen in it hiding the ability to mutate
the list it wraps, but that hardly justifies the overhead on the search
path and extra code complexity. Moreover, the list it references is not
copied/immutable in any way, so the value of hiding is limited also.
2025-02-05 21:08:00 +01:00
Yang Wang
fee57daf53 Merge main into multi-project 2025-02-05 11:03:29 +11:00
Larisa Motova
af213a5f89
Rename AggregateDoubleMetric to *MetricDouble (#121254)
Some areas of the code call this field type
AggregateDoubleMetric and others AggregateMetricDouble, but the docs
use aggregate_metric_double, so for consistency this commit refactors
the former into the latter.
2025-02-04 08:56:04 -10:00
Niels Bauman
6495dcbb40 Merge main into multi-project 2025-01-24 15:48:39 +10:00
David Turner
a1fd7bc374
Fix trappy timeouts in persistent tasks requests (#120514)
Ensure that callers constructing these master-node requests pass in an
explicit timeout.

Relates #107984
2025-01-23 20:35:45 +11:00
Simon Cooper
569c1fc1cd Merge remote-tracking branch 'upstream-main/main' into merge-main-22-01-25T12 2025-01-22 12:22:36 +00:00
Simon Cooper
39601ed683
Remove IndexNameExpressionResolver from base classes that don't use it (#120531) 2025-01-22 10:17:07 +00:00
Tim Vernum
552cec7ff0 Merge revision 34059c9dbd into multi-project 2025-01-17 16:32:15 +11: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
5a70623d8d Merge remote-tracking branch 'upstream-main/main' into merge-main-16-01-25 2025-01-16 09:23:46 +00:00
Niels Bauman
9f597a4eb5
Remove trappy timeouts from GetIndexRequest (#120037)
Relates #107984
2025-01-16 16:05:36 +10:00
Niels Bauman
4605ecf44d
Remove trappy timeouts from GetMappingsRequest (#120035)
Relates #107984
2025-01-14 12:39:41 +10:00
Tim Vernum
280fcb1a57 Merge main into multi-project 2025-01-09 19:39:24 +11:00
Niels Bauman
2153cac4dd
Fix ILMDownsampleDisruptionIT.testILMDownsampleRollingRestart (#119196)
This removes a redundant thread creation when triggering a rolling
restart as the method is already async and drops the check for cluster
health as that might hit a node that's being shut down (the master node
in particular).
2025-01-09 02:16:27 +00:00
Tim Vernum
4ff691f066 Merge revision 7fb6ca447a into multi-project 2024-12-31 15:41:02 +11: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
Niels Bauman
3738202979 Merge main into multi-project 2024-12-24 18:26:13 +01:00
Oleksandr Kolomiiets
c16bcb64a1
Handle index.mapping.ignore_malformed in downsampling (#119134) 2024-12-23 10:48:20 -08:00