aboutsummaryrefslogtreecommitdiff
path: root/weed/shell
diff options
context:
space:
mode:
authorChris Lu <chrislusf@users.noreply.github.com>2022-04-18 09:59:58 -0700
committerGitHub <noreply@github.com>2022-04-18 09:59:58 -0700
commit60ae6082c20ee952835dd9944f67addc0f039ab1 (patch)
tree7ead6210486bbe6bca9a1b23e8bb6e808a6fe356 /weed/shell
parent868b4f894485d1b041daf4cfbfc96856b27eb253 (diff)
parent36c5a59ed8073099c8a5513667c5676f148657f7 (diff)
downloadseaweedfs-60ae6082c20ee952835dd9944f67addc0f039ab1.tar.xz
seaweedfs-60ae6082c20ee952835dd9944f67addc0f039ab1.zip
Merge pull request #2936 from kmlebedev/vacuum_by_vid
shell vacuum volume by collection and volume id
Diffstat (limited to 'weed/shell')
-rw-r--r--weed/shell/command_volume_vacuum.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/weed/shell/command_volume_vacuum.go b/weed/shell/command_volume_vacuum.go
index 61b1f06fa..fc454c9ff 100644
--- a/weed/shell/command_volume_vacuum.go
+++ b/weed/shell/command_volume_vacuum.go
@@ -22,7 +22,7 @@ func (c *commandVacuum) Name() string {
func (c *commandVacuum) Help() string {
return `compact volumes if deleted entries are more than the limit
- volume.vacuum [-garbageThreshold=0.3]
+ volume.vacuum [-garbageThreshold=0.3] [-collection=<collection name>] [-volumeId=<volume id>]
`
}
@@ -31,6 +31,8 @@ func (c *commandVacuum) Do(args []string, commandEnv *CommandEnv, writer io.Writ
volumeVacuumCommand := flag.NewFlagSet(c.Name(), flag.ContinueOnError)
garbageThreshold := volumeVacuumCommand.Float64("garbageThreshold", 0.3, "vacuum when garbage is more than this limit")
+ collection := volumeVacuumCommand.String("collection", "", "vacuum this collection")
+ volumeId := volumeVacuumCommand.Uint("volumeId", 0, "the volume id")
if err = volumeVacuumCommand.Parse(args); err != nil {
return
}
@@ -42,6 +44,8 @@ func (c *commandVacuum) Do(args []string, commandEnv *CommandEnv, writer io.Writ
err = commandEnv.MasterClient.WithClient(false, func(client master_pb.SeaweedClient) error {
_, err = client.VacuumVolume(context.Background(), &master_pb.VacuumVolumeRequest{
GarbageThreshold: float32(*garbageThreshold),
+ VolumeId: uint32(*volumeId),
+ Collection: *collection,
})
return err
})