Skip to content

Commit

Permalink
feat(command/restore): allow controlling auto compaction
Browse files Browse the repository at this point in the history
  • Loading branch information
Michal-Leszczynski committed Oct 3, 2024
1 parent a939782 commit 6730919
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 10 deletions.
5 changes: 5 additions & 0 deletions docs/source/sctool/partials/sctool_restore.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ description: |
a specific follow-up action described by selected type.
usage: sctool restore --cluster <id|name> --location [<dc>:]<provider>:<bucket> --snapshot-tag <tag> [flags]
options:
- name: allow-compaction
default_value: "false"
usage: |
Should auto compactions be running on Scylla nodes during restore.
Disabling auto compactions decreases restore time duration, but increases compaction workload after the restore is done.
- name: batch-size
default_value: "2"
usage: |
Expand Down
5 changes: 5 additions & 0 deletions docs/source/sctool/partials/sctool_restore_update.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ description: |
If there is one restore task the 'restore/task-id' argument is not needed.
usage: sctool restore update --cluster <id|name> [flags] [<restore/task-id>]
options:
- name: allow-compaction
default_value: "false"
usage: |
Should auto compactions be running on Scylla nodes during restore.
Disabling auto compactions decreases restore time duration, but increases compaction workload after the restore is done.
- name: batch-size
default_value: "2"
usage: |
Expand Down
26 changes: 16 additions & 10 deletions pkg/command/restore/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,17 @@ type command struct {
flag.TaskBase
client *managerclient.Client

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

func NewCommand(client *managerclient.Client) *cobra.Command {
Expand Down Expand Up @@ -78,6 +79,7 @@ func (cmd *command) init() {
w.Unwrap().StringVarP(&cmd.snapshotTag, "snapshot-tag", "T", "", "")
w.Unwrap().IntVar(&cmd.batchSize, "batch-size", 2, "")
w.Unwrap().IntVar(&cmd.parallel, "parallel", 1, "")
w.Unwrap().BoolVar(&cmd.allowCompaction, "allow-compaction", false, "")
w.Unwrap().BoolVar(&cmd.restoreSchema, "restore-schema", false, "")
w.Unwrap().BoolVar(&cmd.restoreTables, "restore-tables", false, "")
w.Unwrap().BoolVar(&cmd.dryRun, "dry-run", false, "")
Expand Down Expand Up @@ -144,6 +146,10 @@ func (cmd *command) run(args []string) error {
props["parallel"] = cmd.parallel
ok = true
}
if cmd.Flag("allow-compaction").Changed {
props["allow_compaction"] = cmd.allowCompaction
ok = true
}
if cmd.Flag("restore-schema").Changed {
if cmd.Update() {
return wrapper("restore-schema")
Expand Down
4 changes: 4 additions & 0 deletions pkg/command/restore/res.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ parallel: |
The maximum number of Scylla restore jobs that can be run at the same time (on different SSTables).
Each node can take part in at most one restore at any given moment.
allow-compaction: |
Should auto compactions be running on Scylla nodes during restore.
Disabling auto compactions decreases restore time duration, but increases compaction workload after the restore is done.
restore-schema: |
Specifies restore type (alternative to '--restore-tables' flag).
Restore will recreate schema by applying the backed up output of DESCRIBE SCHEMA WITH INTERNALS via CQL.
Expand Down

0 comments on commit 6730919

Please sign in to comment.