aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAmir H. Yeganemehr <yeganemehr@yahoo.com>2023-11-13 18:36:38 +0330
committerChris Lu <chrislusf@users.noreply.github.com>2023-11-13 08:25:44 -0800
commit6f559fe8386d880a318647334a00cf684328411d (patch)
treee7207c9df08f23ddb60b0d28b541f2ccddd76c32
parentcd01a2346aa14c2fa0a2efeed9e6cf5a9a452b06 (diff)
downloadseaweedfs-6f559fe8386d880a318647334a00cf684328411d.tar.xz
seaweedfs-6f559fe8386d880a318647334a00cf684328411d.zip
fs.mergeVolumes: change dir to a named parameter
-rw-r--r--weed/shell/command_fs_merge_volumes.go16
1 files changed, 8 insertions, 8 deletions
diff --git a/weed/shell/command_fs_merge_volumes.go b/weed/shell/command_fs_merge_volumes.go
index b972c1adf..4a6048a43 100644
--- a/weed/shell/command_fs_merge_volumes.go
+++ b/weed/shell/command_fs_merge_volumes.go
@@ -44,20 +44,14 @@ func (c *commandFsMergeVolumes) Help() string {
This would help clear half-full volumes and let vacuum system to delete them later.
- fs.mergeVolumes [-toVolumeId=y] [-fromVolumeId=x] [-collection="*"] [-apply] [/dir/]
+ fs.mergeVolumes [-toVolumeId=y] [-fromVolumeId=x] [-collection="*"] [-dir=/] [-apply]
`
}
func (c *commandFsMergeVolumes) Do(args []string, commandEnv *CommandEnv, writer io.Writer) (err error) {
- dir, err := commandEnv.parseUrl(findInputDirectory(args))
- if err != nil {
- return err
- }
- if dir != "/" {
- dir = strings.TrimRight(dir, "/")
- }
fsMergeVolumesCommand := flag.NewFlagSet(c.Name(), flag.ContinueOnError)
+ dirArg := fsMergeVolumesCommand.String("dir", "/", "base directory to find and update files")
fromVolumeArg := fsMergeVolumesCommand.Uint("fromVolumeId", 0, "move chunks with this volume id")
toVolumeArg := fsMergeVolumesCommand.Uint("toVolumeId", 0, "change chunks to this volume id")
collectionArg := fsMergeVolumesCommand.String("collection", "*", "Name of collection to merge")
@@ -65,6 +59,12 @@ func (c *commandFsMergeVolumes) Do(args []string, commandEnv *CommandEnv, writer
if err = fsMergeVolumesCommand.Parse(args); err != nil {
return err
}
+
+ dir := *dirArg
+ if dir != "/" {
+ dir = strings.TrimRight(dir, "/")
+ }
+
fromVolumeId := needle.VolumeId(*fromVolumeArg)
toVolumeId := needle.VolumeId(*toVolumeArg)