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

Workflow: Add List-All Command #6533

Merged
merged 4 commits into from
Aug 6, 2020
Merged

Conversation

PrismaPhonic
Copy link
Contributor

@PrismaPhonic PrismaPhonic commented Aug 5, 2020

This PR adds a list-all subcommand to the workflow command. Choosing list-all will return a list of all active workflows for the given keyspace.

The justification for this is that consumers of Vitess (for instance vitess-operator) will need the ability to discover active workflows, and not be required to hold onto workflow state themselves. Being able to discover workflows means that an operator can easily uncover whether resharding is currently ongoing, and act accordingly.

…space.

Signed-off-by: Peter Farr <Peter@PrismaPhonic.com>
Signed-off-by: Peter Farr <Peter@PrismaPhonic.com>
@PrismaPhonic PrismaPhonic marked this pull request as ready for review August 5, 2020 03:08
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.

The cli list-all command has some minor issues. Otherwise LGTM, nice to be able to discover existing workflows!

  • we need to provide a dummy workflow name to pass the keyspace.workflow validation ...
  • in addition to the workflow list, a "no result returned" is tagged on
    if action == "list" {

    need to add list-all to the if condition

I tested by running list-all after exiting test/local_example.sh before 203_switch_reads.sh

$ kvtctl Workflow customer.xx list-all
Workflows: commerce2customerno result returned
$ kvtctl Workflow customer list-all
E0805 11:48:22.661750   10024 main.go:67] remote error: rpc error: code = Unknown desc = invalid format for <keyspace.workflow>: customer
$ alias kvtctl
alias kvtctl='vtctlclient -server localhost:15999'

Copy link
Contributor

@sougou sougou left a comment

Choose a reason for hiding this comment

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

I also noticed that the current syntax is: Workflow ks.shard <verb>. It will look better if it's Workflow <verb> ks.shard. We should do this change in a separate PR.

@@ -478,7 +478,7 @@ var commands = []commandGroup{
"Workflow", []command{
{"Workflow", commandWorkflow,
"<ks.workflow> <action> --dry-run",
"Start/Stop/Delete Workflow on all target tablets in workflow. Example: Workflow merchant.morders Start",
"Start/Stop/Delete/List/List-All Workflow on all target tablets in workflow. Example: Workflow merchant.morders Start",
Copy link
Contributor

Choose a reason for hiding this comment

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

Some suggested renames:
List->Show
List-All -> ListAll

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@sougou List was already there, but just not documented here in the text. It feels a bit out of scope to rename that subcommand in this PR. Are you ok with renaming it in another PR. Also @rohit-nayak-ps thoughts on the naming?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What do you think the analog for ListAll is in the command itself? just listall with no hyphen?

Copy link
Contributor

Choose a reason for hiding this comment

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

@PrismaPhonic, I will work on the List rename and parameter ordering changes Sugu suggested as part of some upcoming changes in the list response (need to report blacklisted tables, routing rules related to the workflow, among other info ...)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Renamed List-All to ListAll as our subcommand naming convention is PascalCase.

Signed-off-by: Peter Farr <Peter@PrismaPhonic.com>
@PrismaPhonic
Copy link
Contributor Author

@rohit-nayak-ps good catch. Fixed!

Signed-off-by: Peter Farr <Peter@PrismaPhonic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants