Commit graph

108 commits

Author SHA1 Message Date
Mary Gouseti
78ac5d58ef
[Failure store] Support failure store for system data streams (#126585)
In this PR we add support for the failure store for system data streams.
Specifically:

- We pass the system descriptor so the failure index can be created based on that.
- We extend the tests to ensure it works
- We remove a guard we had but I wasn't able to test it because it only gets triggered if the data stream gets created right after a failure in the ingest pipeline, and I didn't see how to add one (yet).
- We extend the system data stream migration to ensure this is also working.
2025-04-11 05:14:11 +10:00
Alexey Ivanov
ecf9adfc78
[main] System data streams are not being upgraded in the feature migration API (#126409)
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.

Port of #123926
2025-04-08 20:42:58 +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
Alexey Ivanov
fd7efe587e
[main] Move system indices migration to migrate plugin (#125437)
* [main] Move system indices migration to migrate plugin

It seems the best way to fix #122949 is to use existing data stream reindex API. However, this API is located in the migrate x-pack plugin. This commit moves the system indices migration logic (REST handlers, transport actions, and task) to the migrate plugin.

Port of #123551

* [CI] Auto commit changes from spotless

* Fix compilation

* Fix tests

* Fix test

---------

Co-authored-by: elasticsearchmachine <infra-root+elasticsearchmachine@elastic.co>
2025-04-04 18:49:38 +01:00
Luke Whiting
d816845251
ES-125727 Fix for [CI] ReindexDataStreamTransportActionIT testAlreadyUpToDateDataStream failing (#126123) 2025-04-02 15:34:43 +01:00
Keith Massey
6a74aba04d
Avoid restarting data stream reindex when cluster is upgraded (#125587) 2025-03-26 00:43:46 +02:00
Keith Massey
24132d3834
Reindex data stream indices on different nodes (#125171) 2025-03-20 07:50:10 -05:00
Armin Braun
4c1c51e870
Remove remoteAddress field from TransportResponse (#120016)
This field is only used (by security) for requests, having it in responses is redundant.
Also, we have a couple of responses that are singletons/quasi-enums where setting the value
needlessly might introduce some strange contention even though it's a plain store.

This isn't just a cosmetic change. It makes it clear at compile time that each response instance
is exclusively defined by the bytes that it is read from. This makes it easier to reason about the
validity of suggested optimizations like https://github.com/elastic/elasticsearch/pull/120010
2025-03-16 19:54:29 +01:00
Parker Timmins
d83176d32a
Set cause on create index request in create from action (#124363)
In the create-index-from-source action, we should set the cause of the create index request so that it is clear in the logs. Without setting the cause on the request, the default value of api is used.
2025-03-07 13:14:12 -06:00
Parker Timmins
10a8dcf0fb
Retry ILM async action after reindexing data stream (#124149)
When reindexing a data stream, the ILM metadata is copied from the index metadata of the source index to the destination index. But the ILM state of the new index can be stuck if the source index was in an AsyncAction at the time of reindexing. To un-stick the new index, we call TransportRetryAction to retry the AsyncAction. In the past this action would only run if the index were in the error phase. This change includes an update to TransportRetryAction, which allows it to be run when the index is not in an error phase, if the parameter requireError is set to false.
2025-03-06 12:39:45 -06:00
Keith Massey
ba088b0418
Avoiding a race condition where pending indices count is 0 at start of data stream reindex (#123765) 2025-02-28 16:50:53 -06:00
Yang Wang
cea5adcb49
Add null check in more places for persistent tasks (#123566)
There is no guarantee that a project has non-null persistent tasks [0].
Null check is already done in most places. This PR adds it in a few more
places.

[0] Since health-node is now a cluster-scoped persistent task, it has
become more likely for the project-scoped tasks to be null.

Relates: #123262
2025-02-27 15:10:30 +11:00
Niels Bauman
116b045139 Merge main into multi-project 2025-02-24 17:43:47 +01:00
Niels Bauman
3f51012481
Fix NPE in ReindexDataStreamTransportAction (#123262)
In the multi-project branch, we're making some changes to persistent
tasks and those changes can cause the persistent tasks custom to still
be `null`. This resulted in an NPE here, so I'm fixing the check here.
2025-02-24 13:56:37 +00:00
Tim Vernum
fd9f8e1b08 Merge main into multi-project 2025-02-22 16:42:59 +11:00
Parker Timmins
2cc86b3df7
Add read-block to source index during data stream reindex (#122887)
When reindexing a data stream, we currently add a write block to the source indices so that new documents cannot be added to the index while it is being reindexed. A write block still allows the index to be deleted and for the metadata to be updated. It is possible that ILM could delete a backing index or update a backing index's lifecycle metadata while it is being reindexed. To avoid this, this PR sets a read-only block on the source index. This block must be removed before source index can be deleted after it is replaced with the destination index.
2025-02-21 13:17:26 -06:00
Parker Timmins
f044d97ac1
Add lifecycle setting to destination index after adding to data stream (#123071)
When reindexing a data stream, remove the lifecycle name setting when creating the destination index, so that ILM does not process it. Add the setting back after adding the destination index to the data stream, at which point ILM can safely process it.
2025-02-21 08:46:19 -06:00
Tim Vernum
b29682c931 Merge revision b3959b6642 into multi-project 2025-02-21 19:28:00 +11:00
Luke Whiting
e3792d19b5
Allow data stream reindex tasks to be re-run after completion (#122510)
* Allow data stream reindex tasks to be re-run after completion

* Docs update

* Update docs/reference/migration/apis/data-stream-reindex.asciidoc

Co-authored-by: Keith Massey <keith.massey@elastic.co>

---------

Co-authored-by: Keith Massey <keith.massey@elastic.co>
2025-02-20 15:03:51 +00:00
Tim Vernum
4f918a81b9 Merge main into multi-project 2025-02-20 12:17:12 +11:00
Keith Massey
18df4d0c89
Fixing the document count in reindex data stream status in-progress indices (#122976) 2025-02-20 00:53:50 +01: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
680e7a6979 Merge revision 5c00341c2b into multi-project 2025-02-14 17:17:41 +11:00
Parker Timmins
aba25c628a
Add action to copy index metadata when reindexing data stream indices (#122535)
When reindexing data stream indices, parts of the index metadata needs to be copied from the source index to destination index, so that ILM and data stream lifecycle function properly. This adds a new CopyLifecycleIndexMetadataTransportAction which copies the following metadata from a source index to a destination index:
- creation date setting
- rollover info
- ILM custom metadata
2025-02-13 19:14:30 -06:00
Keith Massey
8c0ab4eab3
Making reindex data streams actions cancellable (#122438) 2025-02-13 00:23:23 +01:00
Parker Timmins
05a2003a9f
Fix ReindexDataStreamIndexAction timestamp validation bug in tests (#122274)
Fix race condition test bugs related to the reindex-data-stream-pipeline. For tests that add doc without timestamp, then add mapping with timestamp, ensure green between adding doc and adding mapping. This makes sure that doc has been written to all shards and thus that timestamp validation does not occur while doc is being written to a shard. Delete pipeline in Before method, then wait for it to be re-created by the MigrateTemplateRegistry.
2025-02-12 08:00:16 -06:00
Yang Wang
04d459009b Merge main into multi-project 2025-02-12 09:57:09 +11:00
Keith Massey
1c5faaa822
If reindex data streams fails on one index, try the next (#122294) 2025-02-11 22:15:00 +01:00
Luke Whiting
2b9d7f6396
Remove index setting when override value is null (#122267) 2025-02-11 17:27:43 +01:00
Luke Whiting
3f021a1aa3
Ensure removal of index blocks does not leave key with null value (#122246)
* ES-10801 Ensure removal of index blocks does not leave key with null value

* Update docs/changelog/122246.yaml
2025-02-11 14:59:35 +00:00
Parker Timmins
89ba03ecff
Remove call to super.cleanupCluster in cleanup methods which does not override parent method (#122209)
ReindexDataStreamIndexAction.cleanupCluster called EsIntegTestCase.cleanupCluster, but did not override it. This caused EsIntegTestCase.cleanupCluster to be called twice, once in ReindexDataStreamIndexAction.cleanupCluster and once when the After annotation is called on EsIntegTestCase.
2025-02-10 14:49:07 -06:00
Keith Massey
27545b0c27
Removing the type from the destination index when using CreateIndexFromSourceAction (#121982)
It is possible to create an index in 7.x with a single type. This fixes the CreateIndexFromSourceAction to not copy that type over when creating a destination index from a source index with a type.
2025-02-07 10:29:20 -06:00
Yang Wang
38d74f7408 Merge main into multi-project 2025-02-06 10:04:49 +11:00
Parker Timmins
0f6b80a98f
Fix tests broken because future not completed during cleanup (#121782)
A future.actionGet was missing from the delete pipeline action execution in the test cleanup, causing all tests to fail intermittently. Also replace actionGet with safeGet.
2025-02-05 21:19:42 +01:00
Yang Wang
fee57daf53 Merge main into multi-project 2025-02-05 11:03:29 +11:00
Parker Timmins
29965bccf0
Add pipeline to clean docs during data stream reindex (#121617)
Add the pipeline "reindex-data-stream-pipeline" to the reindex request within ReindexDataStreamIndexAction. This cleans up documents as needed before inserting into the destination index. Currently, the pipeline only sets a timestamp field with a value of 0, if the document is missing a timestamp field. This is needed because existing indices which are added to a data stream may not contain a timestamp, but reindex validates that a timestamp field exists when creating data stream destination indices.
This pipeline is managed by ES, but can be overriden by users if necessary. To do this, the version field of the pipeline should be set to a value higher than the MigrateRegistry version.
2025-02-04 17:59:21 -06:00
Keith Massey
c77afd8f54
Fail the reindex data stream task if any document fails to reindex (#121591) 2025-02-04 09:36:26 -06:00
Niels Bauman
a15932159a Merge remote-tracking branch 'public/main' into merge-main 2025-02-04 11:19:42 +10:00
Luke Whiting
b559607a94
Various Datastream Reindex Fixes (#121376)
* Fix incorrect value of reindex_required flag on ignored index warning
* Datastream reindex now uses unverified write block to allow retrying failed reindex
2025-02-03 16:45:46 -06:00
Keith Massey
01efd5edea
Passing parent task id to the refresh request within reindex data streams (#121533) 2025-02-03 16:25:42 -06:00
Niels Bauman
da7d58c06c Merge main into multi-project 2025-01-31 11:21:48 +10:00
Parker Timmins
eeb745cfa2
ReindexDataStreamIndex bug in assertion caused by reference equality (#121325)
Assertion was using reference equality on two boxed longs. So assertion could produce false positives. Change to Objects.equals to check value and avoid null check.
2025-01-30 16:09:04 -06:00
Niels Bauman
621a18d947 Merge main into multi-project 2025-01-30 17:26:28 +10:00
Parker Timmins
376e3f52ed
Return 404 if source index missing in ReindexDataStreamIndexAction (#120971)
ReindexDataStreamIndexAction currently has an NPE if the source index has been deleted. Instead return a resource_not_found_exception.
2025-01-28 13:30:52 -06:00
Keith Massey
7e6affbce0
Automatically opening closed indices when reindexing data streams (#120970) 2025-01-28 20:08:37 +01:00
Keith Massey
160bdab8fd
Removing the reindex data stream feature flag (#120677) 2025-01-24 15:56:29 -06:00
Parker Timmins
484a95043d
Refresh source index before reindexing data stream index (#120752)
Add step to the ReindexDatastreamIndexAction which refreshes the source index after setting it to read-only but before calling reindex. Without doing a refresh it is possible for docs from the source index to be missing from the destination index. This happens because the docs arrived before the source index is set to read-only, but because the index hasn't refreshed, the reindex action cannot see these updates.
2025-01-24 09:35:54 -06:00
Niels Bauman
6495dcbb40 Merge main into multi-project 2025-01-24 15:48:39 +10:00
Keith Massey
bc67124a90
Increasng the default value of migrate.data_stream_reindex_max_request_per_second (#120758) 2025-01-23 17:40:50 -06:00