diff options
| author | Chris Lu <chris.lu@gmail.com> | 2021-05-10 02:39:52 -0700 |
|---|---|---|
| committer | Chris Lu <chris.lu@gmail.com> | 2021-05-10 02:39:52 -0700 |
| commit | 9a6aa00e9d1178fb85105dbe1505619b02723015 (patch) | |
| tree | 07ebb48a2fc099a4bfbf89bc014efd12eba0c80e | |
| parent | da0a4e775bcb7cbef3ea4fd5592d0a8cee436d92 (diff) | |
| download | seaweedfs-9a6aa00e9d1178fb85105dbe1505619b02723015.tar.xz seaweedfs-9a6aa00e9d1178fb85105dbe1505619b02723015.zip | |
avoid nil locations
fix https://github.com/chrislusf/seaweedfs/issues/2059
| -rw-r--r-- | weed/topology/topology_event_handling.go | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/weed/topology/topology_event_handling.go b/weed/topology/topology_event_handling.go index e4eb430fe..2f4fba932 100644 --- a/weed/topology/topology_event_handling.go +++ b/weed/topology/topology_event_handling.go @@ -49,7 +49,12 @@ func (t *Topology) SetVolumeCapacityFull(volumeInfo *storage.VolumeInfo) bool { vl.accessLock.RLock() 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 { disk := dn.getOrCreateDisk(volumeInfo.DiskType) |
