diff options
| author | Konstantin Lebedev <9497591+kmlebedev@users.noreply.github.com> | 2022-08-05 05:35:00 +0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-08-04 17:35:00 -0700 |
| commit | 4d08393b7ca8b1a34ed65532955de76cf8843ec2 (patch) | |
| tree | b764fe5f4b927d9b9cf1b83a2f19c87a91d81c8e /weed/server/master_grpc_server_volume.go | |
| parent | 28a1f42962a3c22fa341d62e52ed014ae17c508f (diff) | |
| download | seaweedfs-4d08393b7ca8b1a34ed65532955de76cf8843ec2.tar.xz seaweedfs-4d08393b7ca8b1a34ed65532955de76cf8843ec2.zip | |
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
Diffstat (limited to 'weed/server/master_grpc_server_volume.go')
| -rw-r--r-- | weed/server/master_grpc_server_volume.go | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/weed/server/master_grpc_server_volume.go b/weed/server/master_grpc_server_volume.go index fb13ebd32..d11a98f93 100644 --- a/weed/server/master_grpc_server_volume.go +++ b/weed/server/master_grpc_server_volume.go @@ -85,8 +85,9 @@ func (ms *MasterServer) LookupVolume(ctx context.Context, req *master_pb.LookupV var locations []*master_pb.Location for _, loc := range result.Locations { locations = append(locations, &master_pb.Location{ - Url: loc.Url, - PublicUrl: loc.PublicUrl, + Url: loc.Url, + PublicUrl: loc.PublicUrl, + DataCenter: loc.DataCenter, }) } var auth string @@ -165,17 +166,19 @@ func (ms *MasterServer) Assign(ctx context.Context, req *master_pb.AssignRequest var replicas []*master_pb.Location for _, r := range dnList.Rest() { replicas = append(replicas, &master_pb.Location{ - Url: r.Url(), - PublicUrl: r.PublicUrl, - GrpcPort: uint32(r.GrpcPort), + Url: r.Url(), + PublicUrl: r.PublicUrl, + GrpcPort: uint32(r.GrpcPort), + DataCenter: r.GetDataCenterId(), }) } return &master_pb.AssignResponse{ Fid: fid, Location: &master_pb.Location{ - Url: dn.Url(), - PublicUrl: dn.PublicUrl, - GrpcPort: uint32(dn.GrpcPort), + Url: dn.Url(), + PublicUrl: dn.PublicUrl, + GrpcPort: uint32(dn.GrpcPort), + DataCenter: dn.GetDataCenterId(), }, Count: count, Auth: string(security.GenJwtForVolumeServer(ms.guard.SigningKey, ms.guard.ExpiresAfterSec, fid)), @@ -253,8 +256,9 @@ func (ms *MasterServer) LookupEcVolume(ctx context.Context, req *master_pb.Looku var locations []*master_pb.Location for _, dn := range shardLocations { locations = append(locations, &master_pb.Location{ - Url: string(dn.Id()), - PublicUrl: dn.PublicUrl, + Url: string(dn.Id()), + PublicUrl: dn.PublicUrl, + DataCenter: dn.GetDataCenterId(), }) } resp.ShardIdLocations = append(resp.ShardIdLocations, &master_pb.LookupEcVolumeResponse_EcShardIdLocation{ |
