Skip to content

Commit

Permalink
feat(command/restore): allow for setting --stream-to-all-replicas flag
Browse files Browse the repository at this point in the history
  • Loading branch information
Michal-Leszczynski committed Aug 28, 2024
1 parent 6fc3ec2 commit 81febdc
Showing 1 changed file with 21 additions and 13 deletions.
34 changes: 21 additions & 13 deletions pkg/command/restore/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,19 @@ type command struct {
flag.TaskBase
client *managerclient.Client

cluster string
location []string
keyspace []string
snapshotTag string
batchSize int
parallel int
tableParallel int
restoreSchema bool
restoreTables bool
unpinAgentCPU bool
dryRun bool
showTables bool
cluster string
location []string
keyspace []string
snapshotTag string
batchSize int
parallel int
tableParallel int
restoreSchema bool
restoreTables bool
unpinAgentCPU bool
streamToAllReplicas bool
dryRun bool
showTables bool
}

func NewCommand(client *managerclient.Client) *cobra.Command {
Expand Down Expand Up @@ -84,6 +85,7 @@ func (cmd *command) init() {
w.Unwrap().BoolVar(&cmd.restoreSchema, "restore-schema", false, "")
w.Unwrap().BoolVar(&cmd.restoreTables, "restore-tables", false, "")
w.Unwrap().BoolVar(&cmd.unpinAgentCPU, "unpin-agent-cpu", false, "")
w.Unwrap().BoolVar(&cmd.streamToAllReplicas, "stream-to-all-replicas", false, "")
w.Unwrap().BoolVar(&cmd.dryRun, "dry-run", false, "")
w.Unwrap().BoolVar(&cmd.showTables, "show-tables", false, "")
}
Expand Down Expand Up @@ -170,7 +172,13 @@ func (cmd *command) run(args []string) error {
props["unpin_agent_cpu"] = cmd.unpinAgentCPU
ok = true
}

if cmd.Flag("stream-to-all-replicas").Changed {
if cmd.Update() {
return wrapper("stream-to-all-replicas")
}
props["stream_to_all_replicas"] = cmd.streamToAllReplicas
ok = true
}
if cmd.dryRun {
res, err := cmd.client.GetRestoreTarget(cmd.Context(), cmd.cluster, task)
if err != nil {
Expand Down

0 comments on commit 81febdc

Please sign in to comment.