Skip to content

Initial work on ReindexDatastreamIndexAction #116996

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 32 commits into from
Dec 13, 2024

Conversation

parkertimmins
Copy link
Contributor

@parkertimmins parkertimmins commented Nov 18, 2024

Add an action which reindexes a single data stream index. The contents of this action are not yet complete, but provide a way to wire into the reindex datastream persistent task. Eventually this action will do the following:

  1. make source index read only
  2. delete dest index if exists
  3. create dest index with settings and mappings from source
  4. reindex source into dest index
  5. update dest settings with settings that could not be added before reindex

Add an action which reindexes a single data stream index.
Most of the work involves settings the correct settings before
and after the reindexing. Eventually, this action will handle
reindexing searchable snapshot indices, but this is left out
for now.
@parkertimmins parkertimmins marked this pull request as ready for review November 21, 2024 18:14
@elasticsearchmachine elasticsearchmachine added the needs:triage Requires assignment of a team area label label Nov 21, 2024
@parkertimmins parkertimmins added auto-backport Automatically create backport pull requests when merged v8.18.0 :Data Management/Data streams Data streams and their lifecycles and removed needs:triage Requires assignment of a team area label labels Nov 21, 2024
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-data-management (Team:Data Management)

@elasticsearchmachine elasticsearchmachine added the Team:Data Management Meta label for data/management team label Nov 21, 2024
@elasticsearchmachine
Copy link
Collaborator

Hi @parkertimmins, I've created a changelog YAML for you.

@masseyke
Copy link
Member

Seems fine for an initial pass, once you put the action in OperatorPrivilegesIT. Nothing will actually use this yet, so it's just a placeholder.

.addListener(listener);
}

private void setBlockWrites(String sourceIndexName, ActionListener<AcknowledgedResponse> listener) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we remove the write block on the source index after reindexing? I'm inclined to say it's fine to leave it, but if we failed/cancelled an instance of this call then reran it, the block-writes setting would then be found on the source index and copied to the new dest index.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We discussed adding a flag to the cluster state which says whether an index had block-write before the call to this action. This would then be passed as a param into the action.

assertEquals(endTime, destEnd);
}

// TODO more logsdb/tsdb specific tests
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There was no logsdb/tsdb in 7.x was there? So nothing to upgrade?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh sweet. Well, then I can remove some tests

@parkertimmins parkertimmins merged commit 0a6ce27 into elastic:main Dec 13, 2024
16 checks passed
@parkertimmins parkertimmins deleted the reindex-datastream-index branch December 13, 2024 21:12
@elasticsearchmachine
Copy link
Collaborator

💔 Backport failed

Status Branch Result
8.x Commit could not be cherrypicked due to conflicts

You can use sqren/backport to manually backport by running backport --upstream elastic/elasticsearch --pr 116996

@parkertimmins
Copy link
Contributor Author

💚 All backports created successfully

Status Branch Result
8.x

Questions ?

Please refer to the Backport tool documentation

parkertimmins added a commit to parkertimmins/elasticsearch that referenced this pull request Dec 13, 2024
Add an action to reindex a single index from a source index to a destination index. Unlike the reindex action, this action copies settings and mappings from the source index to the dest index before performing the reindex. This action is part of work to reindex data streams and will be called on each of the backing indices within a data stream.

(cherry picked from commit 0a6ce27)
parkertimmins added a commit that referenced this pull request Dec 13, 2024
Add an action to reindex a single index from a source index to a destination index. Unlike the reindex action, this action copies settings and mappings from the source index to the dest index before performing the reindex. This action is part of work to reindex data streams and will be called on each of the backing indices within a data stream.

(cherry picked from commit 0a6ce27)
maxhniebergall pushed a commit to maxhniebergall/elasticsearch that referenced this pull request Dec 16, 2024
Add an action to reindex a single index from a source index to a destination index. Unlike the reindex action, this action copies settings and mappings from the source index to the dest index before performing the reindex. This action is part of work to reindex data streams and will be called on each of the backing indices within a data stream.

(cherry picked from commit 0a6ce27)
parkertimmins added a commit that referenced this pull request Jan 16, 2025
When creating a destination index, filter any deprecated settings before copying the source settings to the dest index. Specifically, filter out settings with the property IndexSettingDeprecatedInV7AndRemovedInV8 or settings from a specific list  which do not have this property but have no effect in v8.

This also includes a change which reverts the changes that #116996 made to MetadataCreateIndexService. That change factored the method copySettingsFromSource out of prepareResizeIndexSettings so it could be used to filter settings in CreateIndexFromSourceAction. The additional filtering of deprecated property caused the requirements in CreateIndexFromSourceAction and MetadataCreateIndexService to diverge. So this change reverts the original refactor to MetadataCreateIndexService and adds a method similar to copySettingsFromSource to CreateIndexFromSourceAction.
parkertimmins added a commit to parkertimmins/elasticsearch that referenced this pull request Jan 16, 2025
…0163)

When creating a destination index, filter any deprecated settings before copying the source settings to the dest index. Specifically, filter out settings with the property IndexSettingDeprecatedInV7AndRemovedInV8 or settings from a specific list  which do not have this property but have no effect in v8.

This also includes a change which reverts the changes that elastic#116996 made to MetadataCreateIndexService. That change factored the method copySettingsFromSource out of prepareResizeIndexSettings so it could be used to filter settings in CreateIndexFromSourceAction. The additional filtering of deprecated property caused the requirements in CreateIndexFromSourceAction and MetadataCreateIndexService to diverge. So this change reverts the original refactor to MetadataCreateIndexService and adds a method similar to copySettingsFromSource to CreateIndexFromSourceAction.
elasticsearchmachine pushed a commit that referenced this pull request Jan 16, 2025
…120319)

When creating a destination index, filter any deprecated settings before copying the source settings to the dest index. Specifically, filter out settings with the property IndexSettingDeprecatedInV7AndRemovedInV8 or settings from a specific list  which do not have this property but have no effect in v8.

This also includes a change which reverts the changes that #116996 made to MetadataCreateIndexService. That change factored the method copySettingsFromSource out of prepareResizeIndexSettings so it could be used to filter settings in CreateIndexFromSourceAction. The additional filtering of deprecated property caused the requirements in CreateIndexFromSourceAction and MetadataCreateIndexService to diverge. So this change reverts the original refactor to MetadataCreateIndexService and adds a method similar to copySettingsFromSource to CreateIndexFromSourceAction.
rjernst pushed a commit to rjernst/elasticsearch that referenced this pull request Jan 16, 2025
…0163)

When creating a destination index, filter any deprecated settings before copying the source settings to the dest index. Specifically, filter out settings with the property IndexSettingDeprecatedInV7AndRemovedInV8 or settings from a specific list  which do not have this property but have no effect in v8.

This also includes a change which reverts the changes that elastic#116996 made to MetadataCreateIndexService. That change factored the method copySettingsFromSource out of prepareResizeIndexSettings so it could be used to filter settings in CreateIndexFromSourceAction. The additional filtering of deprecated property caused the requirements in CreateIndexFromSourceAction and MetadataCreateIndexService to diverge. So this change reverts the original refactor to MetadataCreateIndexService and adds a method similar to copySettingsFromSource to CreateIndexFromSourceAction.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-backport Automatically create backport pull requests when merged :Data Management/Data streams Data streams and their lifecycles >enhancement Team:Data Management Meta label for data/management team v8.18.0 v9.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants