filer prefer volume server in same data center (#3405)
* initial prefer same data center https://github.com/seaweedfs/seaweedfs/issues/3404 * GetDataCenter * prefer same data center for ReplicationSource * GetDataCenterId * remove glog
This commit is contained in:
committed by
GitHub
parent
28a1f42962
commit
4d08393b7c
@@ -49,7 +49,17 @@ func (fs *FilerServer) assignNewFileInfo(so *operation.StorageOption) (fileId, u
|
||||
return
|
||||
}
|
||||
fileId = assignResult.Fid
|
||||
urlLocation = "http://" + assignResult.Url + "/" + assignResult.Fid
|
||||
assignUrl := assignResult.Url
|
||||
// Prefer same data center
|
||||
if fs.option.DataCenter != "" {
|
||||
for _, repl := range assignResult.Replicas {
|
||||
if repl.DataCenter == fs.option.DataCenter {
|
||||
assignUrl = repl.Url
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
urlLocation = "http://" + assignUrl + "/" + assignResult.Fid
|
||||
if so.Fsync {
|
||||
urlLocation += "?fsync=true"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user