aboutsummaryrefslogtreecommitdiff
path: root/weed/wdclient/masterclient.go
diff options
context:
space:
mode:
authorChris Lu <chrislusf@users.noreply.github.com>2020-11-11 22:09:41 -0800
committerGitHub <noreply@github.com>2020-11-11 22:09:41 -0800
commit827930e2492280c80a1e4dbe2a4e07bf4c7447e5 (patch)
tree8de75aa01a8cec976c546bc64119b4a09b0f3ea8 /weed/wdclient/masterclient.go
parent4300ca814219105b5900ebeea28ee2d6a4ca34c2 (diff)
parent0880aff224976ba1a22f7f1d815a35f2556165dd (diff)
downloadseaweedfs-827930e2492280c80a1e4dbe2a4e07bf4c7447e5.tar.xz
seaweedfs-827930e2492280c80a1e4dbe2a4e07bf4c7447e5.zip
Merge pull request #1610 from kmlebedev/prefer_read_in_this_dc
prefer to read from volumes in this data center
Diffstat (limited to 'weed/wdclient/masterclient.go')
-rw-r--r--weed/wdclient/masterclient.go11
1 files changed, 6 insertions, 5 deletions
diff --git a/weed/wdclient/masterclient.go b/weed/wdclient/masterclient.go
index df8c186f2..e39b9dfdf 100644
--- a/weed/wdclient/masterclient.go
+++ b/weed/wdclient/masterclient.go
@@ -24,14 +24,14 @@ type MasterClient struct {
vidMap
}
-func NewMasterClient(grpcDialOption grpc.DialOption, clientType string, clientHost string, clientGrpcPort uint32, masters []string) *MasterClient {
+func NewMasterClient(grpcDialOption grpc.DialOption, clientType string, clientHost string, clientGrpcPort uint32, clientDataCenter string, masters []string) *MasterClient {
return &MasterClient{
clientType: clientType,
clientHost: clientHost,
grpcPort: clientGrpcPort,
masters: masters,
grpcDialOption: grpcDialOption,
- vidMap: newVidMap(),
+ vidMap: newVidMap(clientDataCenter),
}
}
@@ -89,7 +89,7 @@ func (mc *MasterClient) tryAllMasters() {
}
mc.currentMaster = ""
- mc.vidMap = newVidMap()
+ mc.vidMap = newVidMap("")
}
}
@@ -130,8 +130,9 @@ func (mc *MasterClient) tryConnectToMaster(master string) (nextHintedLeader stri
// process new volume location
loc := Location{
- Url: volumeLocation.Url,
- PublicUrl: volumeLocation.PublicUrl,
+ Url: volumeLocation.Url,
+ PublicUrl: volumeLocation.PublicUrl,
+ DataCenter: volumeLocation.DataCenter,
}
for _, newVid := range volumeLocation.NewVids {
glog.V(1).Infof("%s: %s masterClient adds volume %d", mc.clientType, loc.Url, newVid)