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

Add Workflow Update Client Command #12622

Merged
merged 47 commits into from
Mar 27, 2023
Merged

Conversation

mattlord
Copy link
Contributor

@mattlord mattlord commented Mar 14, 2023

Description

This adds a new update action to the Workflow vtctl client command as well as a new Workflow update vtctldclient command. This allows users to easily modify the cells, tablet-types, and on-ddl configuration parameters of a VReplication workflow. There are other parameters — e.g. see the full list of parameters for MoveTables — that we could potentially add in the future, but for now we're starting with the ones that are always safe to set. The others are dependent on the workflow state and other factors so the application of those changes is more complicated and thus they will only be added in the future based on use-case / demand.

This work will allow us to remove the VReplicationExec vtctl client command as updating a workflow was the last remaining use case for it. As an example, using the Workflow update command would then replace the cumbersome VReplicationExec method used to update the cells parameter here: https://vitess.io/docs/16.0/user-guides/migration/troubleshooting/#corrective-action

You can manually test and play around with the command using the local examples:

cd examples/local
./101_initial_cluster.sh; ./201_customer_tablets.sh; ./202_move_tables.sh

command mysql -u root --socket=${VTDATAROOT}/vt_0000000200/mysql.sock --binary-as-hex=false -e "select source,cell,tablet_types from _vt.vreplication where workflow='commerce2customer'\G"

vtctlclient Workflow -- --cells=zone1 --tablet-types="primary" --on-ddl=exec --dry-run customer.commerce2customer update

vtctlclient Workflow -- --cells=zone1 --tablet-types="primary" --on-ddl=exec customer.commerce2customer update

command mysql -u root --socket=${VTDATAROOT}/vt_0000000200/mysql.sock --binary-as-hex=false -e "select source,cell,tablet_types from _vt.vreplication where workflow='commerce2customer'\G"

...

Example vtctldclient command and output:

$ vtctldclient workflow --keyspace=customer update --workflow=commerce2customer --cells="zone1,zone2"
{
  "summary": "Successfully updated the commerce2customer workflow on (1) target primary tablets in the customer keyspace",
  "details": [
    {
      "tablet": "zone1-201 (customer/0)",
      "changed": true
    }
  ]
}

$ vtctldclient workflow --keyspace=customer update --workflow=commerce2customer --cells="zone1,zone2"
{
  "summary": "Successfully updated the commerce2customer workflow on (1) target primary tablets in the customer keyspace",
  "details": [
    {
      "tablet": "zone1-201 (customer/0)",
      "changed": false
    }
  ]
}

$ vtctldclient workflow --keyspace=customer update --workflow=cust2cust --on-ddl=EXEC_IGNORE --cells="zone1,zone2,zone3"
{
  "summary": "Successfully updated the cust2cust workflow on (2) target primary tablets in the customer keyspace",
  "details": [
    {
      "tablet": "zone1-300 (customer/-80)",
      "changed": true
    },
    {
      "tablet": "zone1-400 (customer/80-)",
      "changed": true
    }
  ]
}

Related Issue(s)

Checklist

@mattlord mattlord added Type: Enhancement Logical improvement (somewhere between a bug and feature) Component: VReplication labels Mar 14, 2023
@vitess-bot vitess-bot bot added NeedsDescriptionUpdate The description is not clear or comprehensive enough, and needs work NeedsWebsiteDocsUpdate What it says labels Mar 14, 2023
@vitess-bot
Copy link
Contributor

vitess-bot bot commented Mar 14, 2023

Review Checklist

Hello reviewers! 👋 Please follow this checklist when reviewing this Pull Request.

General

  • Ensure that the Pull Request has a descriptive title.
  • If this is a change that users need to know about, please apply the release notes (needs details) label so that merging is blocked unless the summary release notes document is included.
  • If a test is added or modified, there should be a documentation on top of the test to explain what the expected behavior is what the test does.

If a new flag is being introduced:

  • Is it really necessary to add this flag?
  • Flag names should be clear and intuitive (as far as possible)
  • Help text should be descriptive.
  • Flag names should use dashes (-) as word separators rather than underscores (_).

If a workflow is added or modified:

  • Each item in Jobs should be named in order to mark it as required.
  • If the workflow should be required, the maintainer team should be notified.

Bug fixes

  • There should be at least one unit or end-to-end test.
  • The Pull Request description should include a link to an issue that describes the bug.

Non-trivial changes

  • There should be some code comments as to why things are implemented the way they are.

New/Existing features

  • Should be documented, either by modifying the existing documentation or creating new documentation.
  • New features should have a link to a feature request issue or an RFC that documents the use cases, corner cases and test cases.

Backward compatibility

  • Protobuf changes should be wire-compatible.
  • Changes to _vt tables and RPCs need to be backward compatible.
  • vtctl command output order should be stable and awk-able.
  • RPC changes should be compatible with vitess-operator
  • If a flag is removed, then it should also be removed from VTop, if used there.

Signed-off-by: Matt Lord <mattalord@gmail.com>
Signed-off-by: Matt Lord <mattalord@gmail.com>
Signed-off-by: Matt Lord <mattalord@gmail.com>
@mattlord mattlord removed the NeedsDescriptionUpdate The description is not clear or comprehensive enough, and needs work label Mar 15, 2023
Signed-off-by: Matt Lord <mattalord@gmail.com>
Signed-off-by: Matt Lord <mattalord@gmail.com>
mattlord added a commit to vitessio/website that referenced this pull request Mar 16, 2023
Signed-off-by: Matt Lord <mattalord@gmail.com>
@mattlord mattlord removed the NeedsWebsiteDocsUpdate What it says label Mar 16, 2023
mattlord added a commit to vitessio/website that referenced this pull request Mar 16, 2023
Signed-off-by: Matt Lord <mattalord@gmail.com>
@mattlord mattlord marked this pull request as ready for review March 16, 2023 02:06
@mattlord mattlord removed the request for review from notfelineit March 16, 2023 02:06
Signed-off-by: Matt Lord <mattalord@gmail.com>
mattlord added a commit to vitessio/website that referenced this pull request Mar 16, 2023
Signed-off-by: Matt Lord <mattalord@gmail.com>
mattlord added a commit to vitessio/website that referenced this pull request Mar 16, 2023
Signed-off-by: Matt Lord <mattalord@gmail.com>
Signed-off-by: Matt Lord <mattalord@gmail.com>
Signed-off-by: Matt Lord <mattalord@gmail.com>
@mattlord
Copy link
Contributor Author

Thank you for the very helpful review @ajm188 ! I believe that I've addressed all of your comments now.

@mattlord mattlord requested a review from ajm188 March 23, 2023 18:39
Signed-off-by: Matt Lord <mattalord@gmail.com>
Signed-off-by: Matt Lord <mattalord@gmail.com>
Signed-off-by: Matt Lord <mattalord@gmail.com>
Copy link
Contributor

@ajm188 ajm188 left a comment

Choose a reason for hiding this comment

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

one question about the any, but i'll approve in case there's no follow-up needed

go/cmd/vtctldclient/command/workflows.go Outdated Show resolved Hide resolved
go/vt/wrangler/vexec.go Show resolved Hide resolved
@mattlord mattlord removed the request for review from dbussink March 23, 2023 22:31
Copy link
Contributor

@ajm188 ajm188 left a comment

Choose a reason for hiding this comment

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

just formally 👍-ing again

Copy link
Contributor

@rohit-nayak-ps rohit-nayak-ps left a comment

Choose a reason for hiding this comment

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

lgtm

Signed-off-by: Matt Lord <mattalord@gmail.com>
I confirmed that we're using nil as the default
generally in the vtctldclient code.

Signed-off-by: Matt Lord <mattalord@gmail.com>
Signed-off-by: Matt Lord <mattalord@gmail.com>
It worked, but the way that the error handling was done
made it seem like it failed (it ONLY showed the errors
from the source primary tablets).

Signed-off-by: Matt Lord <mattalord@gmail.com>
Signed-off-by: Matt Lord <mattalord@gmail.com>
Signed-off-by: Matt Lord <mattalord@gmail.com>
Signed-off-by: Matt Lord <mattalord@gmail.com>
Signed-off-by: Matt Lord <mattalord@gmail.com>
Signed-off-by: Matt Lord <mattalord@gmail.com>
Copy link
Contributor

@ajm188 ajm188 left a comment

Choose a reason for hiding this comment

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

added tests lgtm as well

Copy link
Contributor

@rohit-nayak-ps rohit-nayak-ps left a comment

Choose a reason for hiding this comment

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

e2e test changes look good.

Signed-off-by: Matt Lord <mattalord@gmail.com>
Signed-off-by: Matt Lord <mattalord@gmail.com>
This leaves us with a singular place where this is done
throughout the client code and allows us to uniformly
change it if needed in the future.

Signed-off-by: Matt Lord <mattalord@gmail.com>
Copy link
Contributor

@ajm188 ajm188 left a comment

Choose a reason for hiding this comment

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

🚢 🚢 🚢

@mattlord mattlord merged commit 20e4768 into vitessio:main Mar 27, 2023
@mattlord mattlord deleted the workflow_update branch March 27, 2023 20:34
mattlord added a commit to vitessio/website that referenced this pull request Mar 27, 2023
* Document changes from vitessio/vitess#12622

Signed-off-by: Matt Lord <mattalord@gmail.com>

* Update vtctldclient docs via:
  go run ./tools/vtctldclientdocs/ --vitess-dir "/Users/matt/git/vitess" --version-pairs "workflow_update:17.0"

Signed-off-by: Matt Lord <mattalord@gmail.com>

* Correct info -> note

Signed-off-by: Matt Lord <mattalord@gmail.com>

---------

Signed-off-by: Matt Lord <mattalord@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: VReplication Type: Enhancement Logical improvement (somewhere between a bug and feature)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add Edit/Update Action to Workflow Client Command
4 participants