volume: deletion checks all disk locations

fix https://github.com/chrislusf/seaweedfs/issues/1283
This commit is contained in:
Chris Lu
2020-04-21 14:49:58 -07:00
parent 57df14f76f
commit bafa95045b
2 changed files with 14 additions and 6 deletions

View File

@@ -167,7 +167,7 @@ func (l *DiskLocation) DeleteCollectionFromDiskLocation(collection string) (e er
return
}
func (l *DiskLocation) deleteVolumeById(vid needle.VolumeId) (e error) {
func (l *DiskLocation) deleteVolumeById(vid needle.VolumeId) (found bool, e error) {
v, ok := l.volumes[vid]
if !ok {
return
@@ -176,6 +176,7 @@ func (l *DiskLocation) deleteVolumeById(vid needle.VolumeId) (e error) {
if e != nil {
return
}
found = true
delete(l.volumes, vid)
return
}
@@ -195,7 +196,8 @@ func (l *DiskLocation) DeleteVolume(vid needle.VolumeId) error {
if !ok {
return fmt.Errorf("Volume not found, VolumeId: %d", vid)
}
return l.deleteVolumeById(vid)
_, err := l.deleteVolumeById(vid)
return err
}
func (l *DiskLocation) UnloadVolume(vid needle.VolumeId) error {