prevent empty locations returned

fix https://github.com/chrislusf/seaweedfs/issues/1313
This commit is contained in:
Chris Lu 2020-05-13 03:46:38 -07:00
parent 015dd3a147
commit 3a5e4769cf

View file

@ -72,9 +72,6 @@ func (ms *MasterServer) findVolumeLocation(collection, vid string) operation.Loo
for _, loc := range machines {
locations = append(locations, operation.Location{Url: loc.Url(), PublicUrl: loc.PublicUrl})
}
if locations == nil {
err = fmt.Errorf("volume id %s not found", vid)
}
}
} else {
machines, getVidLocationsErr := ms.MasterClient.GetVidLocations(vid)
@ -83,6 +80,9 @@ func (ms *MasterServer) findVolumeLocation(collection, vid string) operation.Loo
}
err = getVidLocationsErr
}
if len(locations) == 0 && err == nil {
err = fmt.Errorf("volume id %s not found", vid)
}
ret := operation.LookupResult{
VolumeId: vid,
Locations: locations,