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

OnlineDDL in v12: remove legacy code deprecated in earlier version #8971

Merged
merged 4 commits into from
Oct 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion doc/releasenotes/12_0_0_summary.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,10 @@ zone1-0000000100 sourcekeyspace 0 primary 192.168.0.134:15100 192.168.0.134:1710
zone1-0000000101 sourcekeyspace 0 rdonly 192.168.0.134:15101 192.168.0.134:17101 [] <null>
zone1-0000000102 sourcekeyspace 0 replica 192.168.0.134:15102 192.168.0.134:17102 [] <null>
zone1-0000000103 sourcekeyspace 0 rdonly 192.168.0.134:15103 192.168.0.134:17103 [] <null>
```
```

## 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`.
81 changes: 0 additions & 81 deletions go/vt/vtctl/vtctl.go
Original file line number Diff line number Diff line change
Expand Up @@ -771,16 +771,6 @@ var commands = []commandGroup{
},
},
},
{
"Workflow", []command{
{
name: "VExec",
method: commandVExec,
params: "<ks.workflow> <query> --dry-run",
help: "Runs query on all tablets in workflow. Example: VExec merchant.morders \"update _vt.vreplication set Status='Running'\"",
},
},
},
{
"Workflow", []command{
{
Expand Down Expand Up @@ -3343,38 +3333,6 @@ func commandOnlineDDL(ctx context.Context, wr *wrangler.Wrangler, subFlags *flag
}
query = `update _vt.schema_migrations set migration_status='cancel-all'`
}
case "revert":
{
deprecationMessage := `OnlineDDL 'revert' command will be deprecated in version v12. Use "REVERT VITESS_MIGRATION '<uuid>'" SQL command`
log.Warningf(deprecationMessage)

if arg == "" {
return fmt.Errorf("UUID required")
}
uuid = arg
contextUUID, err := schema.CreateUUID()
if err != nil {
return err
}
requestContext := fmt.Sprintf("vtctl:%s", contextUUID)

ddlStrategySetting := schema.NewDDLStrategySetting(schema.DDLStrategyOnline, "")
onlineDDL, err := schema.NewOnlineDDL(keyspace, "", fmt.Sprintf("revert %s", uuid), ddlStrategySetting, requestContext)
if err != nil {
return err
}
conn, err := wr.TopoServer().ConnForCell(ctx, topo.GlobalCell)
if err != nil {
return err
}
err = onlineDDL.WriteTopo(ctx, conn, schema.MigrationRequestsPath())
if err != nil {
return err
}
wr.Logger().Infof("UUID=%+v", onlineDDL.UUID)
wr.Logger().Printf("%s\n", onlineDDL.UUID)
return nil
}
default:
return fmt.Errorf("Unknown OnlineDDL command: %s", command)
}
Expand Down Expand Up @@ -3868,45 +3826,6 @@ 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 \"<query>\"")
}
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 {
Expand Down