mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
shell: volume.fsck deletes a volume is the volume has only orphaned data.
fix https://github.com/chrislusf/seaweedfs/issues/2190
This commit is contained in:
parent
297b41266b
commit
01adc567aa
|
@ -5,6 +5,7 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"flag"
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"github.com/chrislusf/seaweedfs/weed/storage/needle"
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"math"
|
"math"
|
||||||
|
@ -214,8 +215,14 @@ func (c *commandVolumeFsck) findExtraChunksInVolumeServers(volumeIdToVInfo map[u
|
||||||
if vinfo.isEcVolume {
|
if vinfo.isEcVolume {
|
||||||
fmt.Fprintf(writer, "Skip purging for Erasure Coded volumes.\n")
|
fmt.Fprintf(writer, "Skip purging for Erasure Coded volumes.\n")
|
||||||
}
|
}
|
||||||
if err := c.purgeFileIdsForOneVolume(volumeId, orphanFileIds, writer); err != nil {
|
if inUseCount == 0 {
|
||||||
return fmt.Errorf("purge for volume %d: %v\n", volumeId, err)
|
if err := deleteVolume(c.env.option.GrpcDialOption, needle.VolumeId(volumeId), vinfo.server); err != nil {
|
||||||
|
return fmt.Errorf("delete volume %d: %v\n", volumeId, err)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if err := c.purgeFileIdsForOneVolume(volumeId, orphanFileIds, writer); err != nil {
|
||||||
|
return fmt.Errorf("purge for volume %d: %v\n", volumeId, err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue