avoid nil locations

fix https://github.com/chrislusf/seaweedfs/issues/2059
This commit is contained in:
Chris Lu 2021-05-10 02:39:52 -07:00
parent da0a4e775b
commit 9a6aa00e9d

View file

@ -49,7 +49,12 @@ func (t *Topology) SetVolumeCapacityFull(volumeInfo *storage.VolumeInfo) bool {
vl.accessLock.RLock() vl.accessLock.RLock()
defer vl.accessLock.RUnlock() defer vl.accessLock.RUnlock()
for _, dn := range vl.vid2location[volumeInfo.Id].list { vidLocations, found := vl.vid2location[volumeInfo.Id]
if !found {
return false
}
for _, dn := range vidLocations.list {
if !volumeInfo.ReadOnly { if !volumeInfo.ReadOnly {
disk := dn.getOrCreateDisk(volumeInfo.DiskType) disk := dn.getOrCreateDisk(volumeInfo.DiskType)