aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lu <chris.lu@gmail.com>2021-05-21 01:41:34 -0700
committerChris Lu <chris.lu@gmail.com>2021-05-21 01:41:34 -0700
commitf37a4cbd0f76a1e0b566b4cc02ad6fae545a6ff1 (patch)
tree147e02038ec004b450187b2900f85cfeaed6c6c5
parent5d77840cff69f86de5e5dc4539b4ef535b63586d (diff)
downloadseaweedfs-f37a4cbd0f76a1e0b566b4cc02ad6fae545a6ff1.tar.xz
seaweedfs-f37a4cbd0f76a1e0b566b4cc02ad6fae545a6ff1.zip
randomize initial filer
-rw-r--r--weed/filesys/wfs.go2
1 files changed, 2 insertions, 0 deletions
diff --git a/weed/filesys/wfs.go b/weed/filesys/wfs.go
index b634420d6..0307261a3 100644
--- a/weed/filesys/wfs.go
+++ b/weed/filesys/wfs.go
@@ -7,6 +7,7 @@ import (
"github.com/chrislusf/seaweedfs/weed/storage/types"
"github.com/chrislusf/seaweedfs/weed/wdclient"
"math"
+ "math/rand"
"os"
"path"
"sync"
@@ -96,6 +97,7 @@ func NewSeaweedFileSystem(option *Option) *WFS {
},
signature: util.RandomInt32(),
}
+ wfs.option.filerIndex = rand.Intn(len(option.FilerAddresses))
cacheUniqueId := util.Md5String([]byte(option.MountDirectory + option.FilerGrpcAddresses[0] + option.FilerMountRootPath + util.Version()))[0:8]
cacheDir := path.Join(option.CacheDir, cacheUniqueId)
if option.CacheSizeMB > 0 {