Skip to content
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

[Transform] add transform upgrade endpoint #77566

Merged
merged 25 commits into from
Oct 13, 2021

Conversation

hendrikmuhs
Copy link
Contributor

@hendrikmuhs hendrikmuhs commented Sep 10, 2021

Add an _upgrade endpoint to bulk upgrade transforms. _upgrade rewrites all transforms and its artifacts into the latest format to the latest storage(index). If all transforms are upgraded old indices and outdated documents get deleted.

Todo:

  • rest specs
  • docs place holder

@hendrikmuhs hendrikmuhs force-pushed the transform-upgrade branch 5 times, most recently from 8e97475 to a93c2de Compare September 20, 2021 19:33
@hendrikmuhs hendrikmuhs force-pushed the transform-upgrade branch 5 times, most recently from fd0aeac to ed42c75 Compare September 28, 2021 09:48
@hendrikmuhs hendrikmuhs force-pushed the transform-upgrade branch 3 times, most recently from 2ec4e19 to eea9cc0 Compare September 30, 2021 13:45
@hendrikmuhs hendrikmuhs force-pushed the transform-upgrade branch 3 times, most recently from b8e5005 to bf07e9f Compare October 7, 2021 09:48
@hendrikmuhs hendrikmuhs marked this pull request as ready for review October 7, 2021 10:24
@elasticmachine elasticmachine added the Team:ML Meta label for the ML team label Oct 7, 2021
@elasticmachine
Copy link
Collaborator

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

"Test upgrade transform":
- do:
transform.upgrade_transforms:
dry_run: false
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you also add a test case with dry_run==true?

Copy link
Contributor Author

@hendrikmuhs hendrikmuhs Oct 11, 2021

Choose a reason for hiding this comment

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

👍 Note, I have rolling upgrade test in the works (this one will be more meaningful), but I can't check that in as part of this PR, as I 1st need the backport.

DeleteIndexRequest deleteRequest = new DeleteIndexRequest(
TransformInternalIndexConstants.INDEX_NAME_PATTERN,
TransformInternalIndexConstants.INDEX_NAME_PATTERN_DEPRECATED,
"-" + TransformInternalIndexConstants.LATEST_INDEX_VERSIONED_NAME
Copy link
Contributor

Choose a reason for hiding this comment

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

Does the minus ("-") sign mean to exclude an index from being deleted?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, with - one can exclude, see Multi-target syntax

Copy link
Member

@benwtrent benwtrent left a comment

Choose a reason for hiding this comment

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

My two major concerns:

  • How do we recover from the old docs not being deleted after an upgrade?
  • How does this behave in multi-node. We recursively upgrade and that could be on a network thread. I don't think we lock anything, and pushing/popping the listeners from that threadpool is probably just fine. Just paranoid.

Overall, this is some good stuff

Hendrik Muhs and others added 4 commits October 12, 2021 17:12
…transform/action/UpgradeTransformsAction.java

Co-authored-by: Benjamin Trent <ben.w.trent@gmail.com>
@hendrikmuhs
Copy link
Contributor Author

run elasticsearch-ci/part-2

Copy link
Contributor

@przemekwitek przemekwitek left a comment

Choose a reason for hiding this comment

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

LGTM

@hendrikmuhs hendrikmuhs added the auto-backport Automatically create backport pull requests when merged label Oct 13, 2021
@hendrikmuhs hendrikmuhs merged commit 939f81e into elastic:master Oct 13, 2021
@hendrikmuhs hendrikmuhs deleted the transform-upgrade branch October 13, 2021 06:49
@elasticsearchmachine
Copy link
Collaborator

💔 Backport failed

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

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

hendrikmuhs pushed a commit to hendrikmuhs/elasticsearch that referenced this pull request Oct 13, 2021
Add an _upgrade endpoint to bulk upgrade transforms. _upgrade rewrites all transforms and its
artifacts into the latest format to the latest storage(index). If all transforms are upgraded old
indices and outdated documents get deleted. Using the dry_run option it is possible to check if
upgrades are necessary without applying changes.
elasticsearchmachine pushed a commit that referenced this pull request Oct 14, 2021
* [Transform] add transform upgrade endpoint (#77566)

Add an _upgrade endpoint to bulk upgrade transforms. _upgrade rewrites all transforms and its
artifacts into the latest format to the latest storage(index). If all transforms are upgraded old
indices and outdated documents get deleted. Using the dry_run option it is possible to check if
upgrades are necessary without applying changes.

* fix merge conflicts

* 7.x requires a different license check
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 v7.16.0 v8.0.0-beta1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants