mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
add help
This commit is contained in:
parent
1e35b4929f
commit
36c5a59ed8
|
@ -22,7 +22,7 @@ func (c *commandVacuum) Name() string {
|
||||||
func (c *commandVacuum) Help() string {
|
func (c *commandVacuum) Help() string {
|
||||||
return `compact volumes if deleted entries are more than the limit
|
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>]
|
||||||
|
|
||||||
`
|
`
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,7 @@ func (c *commandVacuum) Do(args []string, commandEnv *CommandEnv, writer io.Writ
|
||||||
volumeVacuumCommand := flag.NewFlagSet(c.Name(), flag.ContinueOnError)
|
volumeVacuumCommand := flag.NewFlagSet(c.Name(), flag.ContinueOnError)
|
||||||
garbageThreshold := volumeVacuumCommand.Float64("garbageThreshold", 0.3, "vacuum when garbage is more than this limit")
|
garbageThreshold := volumeVacuumCommand.Float64("garbageThreshold", 0.3, "vacuum when garbage is more than this limit")
|
||||||
collection := volumeVacuumCommand.String("collection", "", "vacuum this collection")
|
collection := volumeVacuumCommand.String("collection", "", "vacuum this collection")
|
||||||
volumeId := volumeVacuumCommand.Int("volumeId", 0, "the volume id")
|
volumeId := volumeVacuumCommand.Uint("volumeId", 0, "the volume id")
|
||||||
if err = volumeVacuumCommand.Parse(args); err != nil {
|
if err = volumeVacuumCommand.Parse(args); err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
@ -185,20 +185,20 @@ func (t *Topology) Vacuum(grpcDialOption grpc.DialOption, garbageThreshold float
|
||||||
for _, vl := range c.storageType2VolumeLayout.Items() {
|
for _, vl := range c.storageType2VolumeLayout.Items() {
|
||||||
if vl != nil {
|
if vl != nil {
|
||||||
volumeLayout := vl.(*VolumeLayout)
|
volumeLayout := vl.(*VolumeLayout)
|
||||||
t.vacuumOneVolumeLayout(grpcDialOption, volumeLayout, c, garbageThreshold, volumeId, preallocate)
|
if volumeId > 0 && volumeLayout.Lookup(needle.VolumeId(volumeId)) == nil {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
t.vacuumOneVolumeLayout(grpcDialOption, volumeLayout, c, garbageThreshold, preallocate)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *Topology) vacuumOneVolumeLayout(grpcDialOption grpc.DialOption, volumeLayout *VolumeLayout, c *Collection, garbageThreshold float64, volumeId uint32, preallocate int64) {
|
func (t *Topology) vacuumOneVolumeLayout(grpcDialOption grpc.DialOption, volumeLayout *VolumeLayout, c *Collection, garbageThreshold float64, preallocate int64) {
|
||||||
|
|
||||||
volumeLayout.accessLock.RLock()
|
volumeLayout.accessLock.RLock()
|
||||||
tmpMap := make(map[needle.VolumeId]*VolumeLocationList)
|
tmpMap := make(map[needle.VolumeId]*VolumeLocationList)
|
||||||
for vid, locationList := range volumeLayout.vid2location {
|
for vid, locationList := range volumeLayout.vid2location {
|
||||||
if volumeId > 0 && volumeId != uint32(vid) {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
tmpMap[vid] = locationList.Copy()
|
tmpMap[vid] = locationList.Copy()
|
||||||
}
|
}
|
||||||
volumeLayout.accessLock.RUnlock()
|
volumeLayout.accessLock.RUnlock()
|
||||||
|
|
Loading…
Reference in a new issue