aboutsummaryrefslogtreecommitdiff
path: root/weed/shell/command_volume_fix_replication.go
diff options
context:
space:
mode:
authorLisandro Pin <lisandro.pin@proton.ch>2025-11-10 04:58:38 +0100
committerGitHub <noreply@github.com>2025-11-09 19:58:38 -0800
commit76e4a519646a60c612956d197652359b1d4ba477 (patch)
tree37de583f5f6e79936bc137afe6e6d4b12e6065a5 /weed/shell/command_volume_fix_replication.go
parent2a05af2e14741540cad00a410f8e851f863628c7 (diff)
downloadseaweedfs-76e4a519646a60c612956d197652359b1d4ba477.tar.xz
seaweedfs-76e4a519646a60c612956d197652359b1d4ba477.zip
Unify the parameter to disable dry-run on weed shell commands to `-apply` (instead of `-force`). (#7450)
* Unify the parameter to disable dry-run on weed shell commands to --apply (instead of --force). * lint * refactor * Execution Order Corrected * handle deprecated force flag * fix help messages * Refactoring]: Using flag.FlagSet.Visit() * consistent with other commands * Checks for both flags * fix toml files --------- Co-authored-by: chrislu <chris.lu@gmail.com>
Diffstat (limited to 'weed/shell/command_volume_fix_replication.go')
-rw-r--r--weed/shell/command_volume_fix_replication.go9
1 files changed, 6 insertions, 3 deletions
diff --git a/weed/shell/command_volume_fix_replication.go b/weed/shell/command_volume_fix_replication.go
index 7fa6e5ed8..29bfe3f76 100644
--- a/weed/shell/command_volume_fix_replication.go
+++ b/weed/shell/command_volume_fix_replication.go
@@ -46,7 +46,7 @@ func (c *commandVolumeFixReplication) Help() string {
If the free slots satisfy the replication requirement, the volume content is copied over and mounted.
volume.fix.replication # do not take action
- volume.fix.replication -force # actually deleting or copying the volume files and mount the volume
+ volume.fix.replication -apply # actually deleting or copying the volume files and mount the volume
volume.fix.replication -collectionPattern=important* # fix any collections with prefix "important"
Note:
@@ -66,7 +66,9 @@ func (c *commandVolumeFixReplication) Do(args []string, commandEnv *CommandEnv,
volFixReplicationCommand := flag.NewFlagSet(c.Name(), flag.ContinueOnError)
c.collectionPattern = volFixReplicationCommand.String("collectionPattern", "", "match with wildcard characters '*' and '?'")
- applyChanges := volFixReplicationCommand.Bool("force", false, "apply the fix")
+ applyChanges := volFixReplicationCommand.Bool("apply", false, "apply the fix")
+ // TODO: remove this alias
+ applyChangesAlias := volFixReplicationCommand.Bool("force", false, "apply the fix (alias for -apply)")
doDelete := volFixReplicationCommand.Bool("doDelete", true, "Also delete over-replicated volumes besides fixing under-replication")
doCheck := volFixReplicationCommand.Bool("doCheck", true, "Also check synchronization before deleting")
maxParallelization := volFixReplicationCommand.Int("maxParallelization", DefaultMaxParallelization, "run up to X tasks in parallel, whenever possible")
@@ -76,8 +78,9 @@ func (c *commandVolumeFixReplication) Do(args []string, commandEnv *CommandEnv,
if err = volFixReplicationCommand.Parse(args); err != nil {
return nil
}
- infoAboutSimulationMode(writer, *applyChanges, "-force")
+ handleDeprecatedForceFlag(writer, volFixReplicationCommand, applyChangesAlias, applyChanges)
+ infoAboutSimulationMode(writer, *applyChanges, "-apply")
commandEnv.noLock = !*applyChanges
if err = commandEnv.confirmIsLocked(args); *applyChanges && err != nil {