volume: fail the volume deletion if compaction is in progress

fix https://github.com/chrislusf/seaweedfs/issues/1035
This commit is contained in:
Chris Lu
2019-08-12 00:53:50 -07:00
parent 6f75df8660
commit e40634e6b4
3 changed files with 23 additions and 0 deletions

View File

@@ -43,6 +43,10 @@ func (v *Volume) Destroy() (err error) {
err = fmt.Errorf("%s is read-only", v.dataFile.Name())
return
}
if v.isCompacting {
err = fmt.Errorf("volume %d is compacting", v.Id)
return
}
v.Close()
os.Remove(v.FileName() + ".dat")
os.Remove(v.FileName() + ".idx")