diff options
| author | Chris Lu <chris.lu@gmail.com> | 2019-02-20 01:01:01 -0800 |
|---|---|---|
| committer | Chris Lu <chris.lu@gmail.com> | 2019-02-20 01:01:01 -0800 |
| commit | e10868899067ad72f822e0d9571b33fa9d1fc7f6 (patch) | |
| tree | 6376da9bf7df15459fc429a18cce989151e5a316 /weed/topology | |
| parent | 097b7a321eae4a70d375ca6d3dea1b118fe77795 (diff) | |
| download | seaweedfs-e10868899067ad72f822e0d9571b33fa9d1fc7f6.tar.xz seaweedfs-e10868899067ad72f822e0d9571b33fa9d1fc7f6.zip | |
avoid grpc 5 seconds timeout
some operations may take longer than 5 seconds.
only keep the timeout for raft operations
Diffstat (limited to 'weed/topology')
| -rw-r--r-- | weed/topology/allocate_volume.go | 8 | ||||
| -rw-r--r-- | weed/topology/topology_vacuum.go | 5 |
2 files changed, 3 insertions, 10 deletions
diff --git a/weed/topology/allocate_volume.go b/weed/topology/allocate_volume.go index ff0bbce42..66b1b3af5 100644 --- a/weed/topology/allocate_volume.go +++ b/weed/topology/allocate_volume.go @@ -2,12 +2,10 @@ package topology import ( "context" - "google.golang.org/grpc" - "time" - "github.com/chrislusf/seaweedfs/weed/operation" "github.com/chrislusf/seaweedfs/weed/pb/volume_server_pb" "github.com/chrislusf/seaweedfs/weed/storage" + "google.golang.org/grpc" ) type AllocateVolumeResult struct { @@ -17,10 +15,8 @@ type AllocateVolumeResult struct { func AllocateVolume(dn *DataNode, grpcDialOption grpc.DialOption, vid storage.VolumeId, option *VolumeGrowOption) error { return operation.WithVolumeServerClient(dn.Url(), grpcDialOption, func(client volume_server_pb.VolumeServerClient) error { - ctx, cancel := context.WithTimeout(context.Background(), time.Duration(5*time.Second)) - defer cancel() - _, deleteErr := client.AssignVolume(ctx, &volume_server_pb.AssignVolumeRequest{ + _, deleteErr := client.AssignVolume(context.Background(), &volume_server_pb.AssignVolumeRequest{ VolumdId: uint32(vid), Collection: option.Collection, Replication: option.ReplicaPlacement.String(), diff --git a/weed/topology/topology_vacuum.go b/weed/topology/topology_vacuum.go index 71d3ead76..840821efa 100644 --- a/weed/topology/topology_vacuum.go +++ b/weed/topology/topology_vacuum.go @@ -16,10 +16,7 @@ func batchVacuumVolumeCheck(grpcDialOption grpc.DialOption, vl *VolumeLayout, vi for index, dn := range locationlist.list { go func(index int, url string, vid storage.VolumeId) { err := operation.WithVolumeServerClient(url, grpcDialOption, func(volumeServerClient volume_server_pb.VolumeServerClient) error { - ctx, cancel := context.WithTimeout(context.Background(), time.Duration(5*time.Second)) - defer cancel() - - resp, err := volumeServerClient.VacuumVolumeCheck(ctx, &volume_server_pb.VacuumVolumeCheckRequest{ + resp, err := volumeServerClient.VacuumVolumeCheck(context.Background(), &volume_server_pb.VacuumVolumeCheckRequest{ VolumdId: uint32(vid), }) if err != nil { |
