From baaad4035b75f188d6bde41a29d19461fe3d36cb Mon Sep 17 00:00:00 2001 From: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com> Date: Sun, 14 Nov 2021 12:45:40 +0200 Subject: [PATCH 1/2] restore 'vtctl VExec' command Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com> --- doc/releasenotes/12_0_0_release_notes.md | 2 - go/vt/vtctl/vtctl.go | 49 ++++++++++++++++++++++++ 2 files changed, 49 insertions(+), 2 deletions(-) diff --git a/doc/releasenotes/12_0_0_release_notes.md b/doc/releasenotes/12_0_0_release_notes.md index 5cf5d0baf68..c4b7e56d008 100644 --- a/doc/releasenotes/12_0_0_release_notes.md +++ b/doc/releasenotes/12_0_0_release_notes.md @@ -31,8 +31,6 @@ zone1-0000000103 sourcekeyspace 0 rdonly 192.168.0.134:15103 192.168.0.134:17103 ## Deprecations -The command `vtctl VExec` is deprecated and removed. All Online DDL commands should run through `vtctl OnlineDDL`. - The command `vtctl OnlineDDL revert` is deprecated. Use `REVERT VITESS_MIGRATION '...'` SQL command either via `vtctl ApplySchema` or via `vtgate`. diff --git a/go/vt/vtctl/vtctl.go b/go/vt/vtctl/vtctl.go index f491f5053b9..bba50603ad5 100644 --- a/go/vt/vtctl/vtctl.go +++ b/go/vt/vtctl/vtctl.go @@ -766,6 +766,16 @@ var commands = []commandGroup{ }, }, }, + { + "Workflow", []command{ + { + name: "VExec", + method: commandVExec, + params: " --dry-run", + help: "Runs query on all tablets in workflow. Example: VExec merchant.morders \"update _vt.vreplication set Status='Running'\"", + }, + }, + }, { "Workflow", []command{ { @@ -3791,6 +3801,45 @@ func commandHelp(ctx context.Context, wr *wrangler.Wrangler, subFlags *flag.Flag return nil } +func commandVExec(ctx context.Context, wr *wrangler.Wrangler, subFlags *flag.FlagSet, args []string) error { + deprecationMessage := `VExec command will be deprecated in version v12. For Online DDL control, use "vtctl OnlineDDL" commands or SQL syntax` + log.Warningf(deprecationMessage) + + json := subFlags.Bool("json", false, "Output JSON instead of human-readable table") + dryRun := subFlags.Bool("dry_run", false, "Does a dry run of VExec and only reports the final query and list of tablets on which it will be applied") + if err := subFlags.Parse(args); err != nil { + return err + } + if subFlags.NArg() != 2 { + return fmt.Errorf("usage: VExec --dry-run keyspace.workflow \"\"") + } + keyspace, workflow, err := splitKeyspaceWorkflow(subFlags.Arg(0)) + if err != nil { + return err + } + _, err = wr.TopoServer().GetKeyspace(ctx, keyspace) + if err != nil { + wr.Logger().Errorf("keyspace %s not found", keyspace) + } + query := subFlags.Arg(1) + + qr, err := wr.VExecResult(ctx, workflow, keyspace, query, *dryRun) + if err != nil { + return err + } + if *dryRun { + return nil + } + if qr == nil { + wr.Logger().Printf("no result returned\n") + } + if *json { + return printJSON(wr.Logger(), qr) + } + printQueryResult(loggerWriter{wr.Logger()}, qr) + return nil +} + func commandWorkflow(ctx context.Context, wr *wrangler.Wrangler, subFlags *flag.FlagSet, args []string) error { dryRun := subFlags.Bool("dry_run", false, "Does a dry run of Workflow and only reports the final query and list of tablets on which the operation will be applied") if err := subFlags.Parse(args); err != nil { From b0e2e859cd105dd5a6a0c134e705b1a0acf12c40 Mon Sep 17 00:00:00 2001 From: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com> Date: Wed, 17 Nov 2021 10:16:55 +0200 Subject: [PATCH 2/2] restored original 12.0.0 release notes, created 12.0.1 release ntoes Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com> --- doc/releasenotes/12_0_0_release_notes.md | 2 ++ doc/releasenotes/12_0_1_release_notes.md | 17 +++++++++++++++++ doc/releasenotes/12_0_1_summary.md | 0 3 files changed, 19 insertions(+) create mode 100644 doc/releasenotes/12_0_1_release_notes.md create mode 100644 doc/releasenotes/12_0_1_summary.md diff --git a/doc/releasenotes/12_0_0_release_notes.md b/doc/releasenotes/12_0_0_release_notes.md index c4b7e56d008..5cf5d0baf68 100644 --- a/doc/releasenotes/12_0_0_release_notes.md +++ b/doc/releasenotes/12_0_0_release_notes.md @@ -31,6 +31,8 @@ zone1-0000000103 sourcekeyspace 0 rdonly 192.168.0.134:15103 192.168.0.134:17103 ## Deprecations +The command `vtctl VExec` is deprecated and removed. All Online DDL commands should run through `vtctl OnlineDDL`. + The command `vtctl OnlineDDL revert` is deprecated. Use `REVERT VITESS_MIGRATION '...'` SQL command either via `vtctl ApplySchema` or via `vtgate`. diff --git a/doc/releasenotes/12_0_1_release_notes.md b/doc/releasenotes/12_0_1_release_notes.md new file mode 100644 index 00000000000..b927539ec4a --- /dev/null +++ b/doc/releasenotes/12_0_1_release_notes.md @@ -0,0 +1,17 @@ +# Release of Vitess v12.0.1 + +## Major Changes + + +## Deprecations + +## Minor Changes + +### vtctl VExec + +The command `vtctl VExec` is restored after being deprecated in `v12.0.0`. + + +------------ +## Changelog + diff --git a/doc/releasenotes/12_0_1_summary.md b/doc/releasenotes/12_0_1_summary.md new file mode 100644 index 00000000000..e69de29bb2d