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.
Go blob-storagecloud-drivedistributed-file-systemdistributed-storageerasure-codingfusehadoop-hdfshdfskuberneteslancelancedbobject-storageposixs3s3-storageseaweedfstiered-file-systemvector-search
avoid using global rand
Chris Lu5ae4b963a47a
diff --git a/weed/wdclient/vid_map.go b/weed/wdclient/vid_map.goindex aef29f56fd..64c24a809d 100644--- a/weed/wdclient/vid_map.go+++ b/weed/wdclient/vid_map.go@@ -7,6 +7,7 @@ import ("strconv""strings""sync"+ "time""github.com/chrislusf/seaweedfs/weed/glog")@@ -19,11 +20,13 @@ type Location struct {type vidMap struct {sync.RWMutexvid2Locations map[uint32][]Location+ r *rand.Rand}func newVidMap() vidMap {return vidMap{vid2Locations: make(map[uint32][]Location),+ r: rand.New(rand.NewSource(time.Now().UnixNano())),}}@@ -39,7 +42,7 @@ func (vc *vidMap) LookupVolumeServerUrl(vid string) (serverUrl string, err errorreturn "", fmt.Errorf("volume %d not found", id)}- return locations[rand.Intn(len(locations))].Url, nil+ return locations[vc.r.Intn(len(locations))].Url, nil}func (vc *vidMap) LookupFileId(fileId string) (fullUrl string, err error) {