diff options
| author | Chris Lu <chris.lu@gmail.com> | 2020-10-01 07:10:03 -0700 |
|---|---|---|
| committer | Chris Lu <chris.lu@gmail.com> | 2020-10-01 07:10:03 -0700 |
| commit | a1c01d716b2fd30fa4c99c65b88a814ef750e3e5 (patch) | |
| tree | 783baec04359d64919e240884a3b555a5d67f774 | |
| parent | a34bad2cee0e87c59080405dfdc24e4bf37c89a1 (diff) | |
| download | seaweedfs-a1c01d716b2fd30fa4c99c65b88a814ef750e3e5.tar.xz seaweedfs-a1c01d716b2fd30fa4c99c65b88a814ef750e3e5.zip | |
volume: avoid deadlock when deleting volumes
fix https://github.com/chrislusf/seaweedfs/issues/1501
| -rw-r--r-- | weed/storage/disk_location.go | 3 | ||||
| -rw-r--r-- | weed/storage/store.go | 4 |
2 files changed, 3 insertions, 4 deletions
diff --git a/weed/storage/disk_location.go b/weed/storage/disk_location.go index 9ecc57459..c309b3f92 100644 --- a/weed/storage/disk_location.go +++ b/weed/storage/disk_location.go @@ -174,9 +174,6 @@ func (l *DiskLocation) DeleteCollectionFromDiskLocation(collection string) (e er } func (l *DiskLocation) deleteVolumeById(vid needle.VolumeId) (found bool, e error) { - l.volumesLock.Lock() - defer l.volumesLock.Unlock() - v, ok := l.volumes[vid] if !ok { return diff --git a/weed/storage/store.go b/weed/storage/store.go index 48cbeb3d1..d5d59235a 100644 --- a/weed/storage/store.go +++ b/weed/storage/store.go @@ -380,10 +380,12 @@ func (s *Store) DeleteVolume(i needle.VolumeId) error { Ttl: v.Ttl.ToUint32(), } for _, location := range s.Locations { - if found, err := location.deleteVolumeById(i); found && err == nil { + if err := location.DeleteVolume(i); err == nil { glog.V(0).Infof("DeleteVolume %d", i) s.DeletedVolumesChan <- message return nil + } else { + glog.Errorf("DeleteVolume %d: %v", i, err) } } |
