From 9ef5a5ba09658378e1cef8de148cd06562eff70a Mon Sep 17 00:00:00 2001 From: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com> Date: Tue, 2 Jul 2024 16:32:18 +0300 Subject: [PATCH] vtctldclient OnlineDDL cancel all Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com> --- go/cmd/vtctldclient/command/onlineddl.go | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/go/cmd/vtctldclient/command/onlineddl.go b/go/cmd/vtctldclient/command/onlineddl.go index 6193de9b2af..8f697907de6 100644 --- a/go/cmd/vtctldclient/command/onlineddl.go +++ b/go/cmd/vtctldclient/command/onlineddl.go @@ -55,8 +55,8 @@ var ( RunE: commandOnlineDDLCancel, } OnlineDDLCleanup = &cobra.Command{ - Use: "cleanup ", - Short: "Mark a given schema migration ready for artifact cleanup.", + Use: "cleanup ", + Short: "Mark a given schema migration, or all complete/failed/cancelled migrations, ready for artifact cleanup.", Example: "OnlineDDL cleanup test_keyspace 82fa54ac_e83e_11ea_96b7_f875a4d24e90", DisableFlagsInUseLine: true, Args: cobra.ExactArgs(2), @@ -167,12 +167,10 @@ func commandOnlineDDLCancel(cmd *cobra.Command, args []string) error { } func commandOnlineDDLCleanup(cmd *cobra.Command, args []string) error { - keyspace := cmd.Flags().Arg(0) - uuid := cmd.Flags().Arg(1) - if !schema.IsOnlineDDLUUID(uuid) { - return fmt.Errorf("%s is not a valid UUID", uuid) + keyspace, uuid, err := analyzeOnlineDDLCommandWithUuidOrAllArgument(cmd) + if err != nil { + return err } - cli.FinishedParsing(cmd) resp, err := client.CleanupSchemaMigration(commandCtx, &vtctldatapb.CleanupSchemaMigrationRequest{