Browse Source

prevent empty locations returned

fix https://github.com/chrislusf/seaweedfs/issues/1313
pull/1315/head
Chris Lu 5 years ago
parent
commit
3a5e4769cf
  1. 6
      weed/server/master_server_handlers.go

6
weed/server/master_server_handlers.go

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

Loading…
Cancel
Save