Skip to content

[Deprecation] Add transform_ids to outdated index #120821

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 8 commits into from
Jan 28, 2025

Conversation

prwhelan
Copy link
Member

@prwhelan prwhelan commented Jan 24, 2025

When a transform is writing to an outdated destination index, the transform's id will show up in the index's deprecation warning under index_settings._meta.transform_ids.


Notes:

  • Moved the call to get all Transform Configs out of the TransformDeprecationChecker and into the top-level TransportDeprecationInfoAction
  • TransportDeprecationInfoAction passes the list of TransformConfigs to the TransformDeprecationChecker
  • TransportDeprecationInfoAction aggregates the transform ids by destination index and passes that into DeprecationInfoActions
  • IndexDeprecationChecks now reads the destination index => transform ids map to append the transform ids to the _meta field if the destination index is out of date
  • IndexDeprecationChecks now has its own declaration @FunctionalInterface like Node checks
  • IndexDeprecationChecks now has its own Components blob object like the Plugin checks (hopefully making it easier to add more parameters the next time we have to do this)

Testing done:

  • verified deprecation warnings when no transforms exist
  • verified deprecation warnings include the transform id with 1 transform
  • verified deprecation warnings include the transform ids with 200 transforms writing to one index
  • verified deprecation warnings include the transform ids with 200 transforms writing to 200 indices
  • verified deprecation warnings include the transform ids with 2000 transforms writing to 999 indices

When a transform is writing to an outdated destination index, the
transform's id will show up in the index's deprecation warning
under `index_settings._meta.transform_ids`.
@prwhelan prwhelan added >enhancement :ml/Transform Transform Team:ML Meta label for the ML team auto-backport Automatically create backport pull requests when merged v9.0.0 v8.18.0 labels Jan 24, 2025
@elasticsearchmachine
Copy link
Collaborator

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

@prwhelan prwhelan marked this pull request as ready for review January 24, 2025 19:07
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/ml-core (Team:ML)

@@ -42,7 +47,7 @@
public class TransportDeprecationInfoAction extends TransportMasterNodeReadAction<
DeprecationInfoAction.Request,
DeprecationInfoAction.Response> {
private static final List<DeprecationChecker> PLUGIN_CHECKERS = List.of(new MlDeprecationChecker(), new TransformDeprecationChecker());
private static final DeprecationChecker ML_CHECKER = new MlDeprecationChecker();
Copy link
Member

Choose a reason for hiding this comment

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

I don't know if we want to get rid of PLUGIN_CHECKERS, do we? I would not be surprised if some new ones get added soon (although I don't know of any). There were 3 in the 7->8 upgrade.

Copy link
Member Author

Choose a reason for hiding this comment

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

We could add it back if you'd like? That would make line 132 look something like:

Stream.concat(PLUGIN_CHECKERS.stream(), Stream.of(new TransformDeprecationChecker(transformConfigs))).toList()

To account for the static and non-static objects

@@ -172,4 +180,46 @@ static void pluginSettingIssues(
}
}

private void transformConfigs(ActionListener<List<TransformConfig>> transformConfigsListener) {
Copy link
Member

Choose a reason for hiding this comment

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

Given that we've got a Client in the components that TransformDeprecationChecker receives, would it make sense to fetch the transform configs at the beginning of TransformDeprecationChecker::check instead, to avoid putting all of this ML-specific code into TransportDeprecationInfoAction (and the IndexDeprecationChecks API)? I haven't fully thought that through, so maybe there's a reason it has to be here?

Copy link
Member Author

Choose a reason for hiding this comment

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

I agree that it's not great, this isn't my favorite PR.

I moved it from TransformDeprecationChecker because the index checks run after and now will now need to know about Transform Configs, so it felt like we should move the call up the stack so that the results can be shared between the two.

The alternative (that I thought of) was passing the TransformConfigs back from TransformDeprecationChecker and doing some sort instance of check to get the data out and pass it to the index check. I also tried moving all the index checks to their own DeprecationChecker but that was significantly messier.

Pretty much anything that writes to an index needs some way handle the reindexing (transforms, data streams, maybe ESQL one day), we just don't really have a pattern for that yet.

assertEquals(singletonList(expected), issues);
}

public void testOldTransformIndicesCheck() {
Copy link
Member

Choose a reason for hiding this comment

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

Should we have tests for the case where multiple transform destination indices are outdated either for the same index or for different ones?

Copy link
Member

@dan-rubinstein dan-rubinstein left a comment

Choose a reason for hiding this comment

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

LGTM

@prwhelan prwhelan merged commit 6718774 into elastic:main Jan 28, 2025
16 checks passed
@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 120821

prwhelan added a commit to prwhelan/elasticsearch that referenced this pull request Jan 29, 2025
When a transform is writing to an outdated destination index, the
transform's id will show up in the index's deprecation warning
under `index_settings._meta.transform_ids`.
elasticsearchmachine pushed a commit that referenced this pull request Jan 29, 2025
When a transform is writing to an outdated destination index, the
transform's id will show up in the index's deprecation warning
under `index_settings._meta.transform_ids`.
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 backport pending >enhancement :ml/Transform Transform Team:ML Meta label for the ML team v8.18.0 v9.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants