aboutsummaryrefslogtreecommitdiff
path: root/weed/wdclient/masterclient.go
diff options
context:
space:
mode:
authorChris Lu <chrislusf@users.noreply.github.com>2022-07-19 11:38:43 -0700
committerGitHub <noreply@github.com>2022-07-19 11:38:43 -0700
commit9667588af010e8e331bf58992f7014077236365b (patch)
treed393ed718ebfbb11433ea4f96a8c82a3905e581f /weed/wdclient/masterclient.go
parentf0d560060f86b0ddf10800eafe5f9114de6db1f9 (diff)
parent7b1497ee63ce4126236d08ab54d9d6e22e43556d (diff)
downloadseaweedfs-9667588af010e8e331bf58992f7014077236365b.tar.xz
seaweedfs-9667588af010e8e331bf58992f7014077236365b.zip
Merge pull request #3318 from kmlebedev/issues/3310
Use fallback if urls are not found
Diffstat (limited to 'weed/wdclient/masterclient.go')
-rw-r--r--weed/wdclient/masterclient.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/weed/wdclient/masterclient.go b/weed/wdclient/masterclient.go
index 3e76dc0c5..d6a06bb57 100644
--- a/weed/wdclient/masterclient.go
+++ b/weed/wdclient/masterclient.go
@@ -2,6 +2,7 @@ package wdclient
import (
"context"
+ "fmt"
"github.com/chrislusf/seaweedfs/weed/stats"
"math/rand"
"time"
@@ -44,7 +45,7 @@ func (mc *MasterClient) GetLookupFileIdFunction() LookupFileIdFunctionType {
func (mc *MasterClient) LookupFileIdWithFallback(fileId string) (fullUrls []string, err error) {
fullUrls, err = mc.vidMap.LookupFileId(fileId)
- if err == nil {
+ if err == nil && len(fullUrls) > 0 {
return
}
err = pb.WithMasterClient(false, mc.currentMaster, mc.grpcDialOption, func(client master_pb.SeaweedClient) error {
@@ -52,7 +53,7 @@ func (mc *MasterClient) LookupFileIdWithFallback(fileId string) (fullUrls []stri
VolumeOrFileIds: []string{fileId},
})
if err != nil {
- return err
+ return fmt.Errorf("LookupVolume failed: %v", err)
}
for vid, vidLocation := range resp.VolumeIdLocations {
for _, vidLoc := range vidLocation.Locations {
@@ -65,7 +66,6 @@ func (mc *MasterClient) LookupFileIdWithFallback(fileId string) (fullUrls []stri
fullUrls = append(fullUrls, "http://"+loc.Url+"/"+fileId)
}
}
-
return nil
})
return