Skip to content

SeaweedFS is a distributed storage system for object storage (S3), file systems, Iceberg table buckets, and Lance vector buckets, designed to handle billions of files with O(1) disk access and effortless horizontal scaling.

add retry if volume can not be found

Chris Lu8a52379ecb8a
diff --git a/weed/filer/reader_at.go b/weed/filer/reader_at.go
index 461ef2b2ca..4d0cde850d 100644
--- a/weed/filer/reader_at.go
+++ b/weed/filer/reader_at.go
@@ -11,6 +11,7 @@ import (
"io"
"math/rand"
"sync"
+ "time"
)
type ChunkReadAt struct {
@@ -37,7 +38,8 @@ func LookupFn(filerClient filer_pb.FilerClient) LookupFileIdFunctionType {
vid := VolumeId(fileId)
locations, found := vidCache[vid]
- if !found {
+ waitTime := time.Second
+ for !found && waitTime < 6*time.Second {
// println("looking up volume", vid)
err = filerClient.WithFilerClient(func(client filer_pb.SeaweedFilerClient) error {
resp, err := client.LookupVolume(context.Background(), &filer_pb.LookupVolumeRequest{
@@ -56,6 +58,12 @@ func LookupFn(filerClient filer_pb.FilerClient) LookupFileIdFunctionType {
return nil
})
+ if err == nil {
+ break
+ }
+ glog.V(1).Infof("wait for volume %s", vid)
+ time.Sleep(waitTime)
+ waitTime += waitTime / 2
}
if err != nil {