Skip to content

Commit

Permalink
ticlient: set max send/recv msg size match tikv's config (#10706) (#1…
Browse files Browse the repository at this point in the history
  • Loading branch information
lysu authored and zz-jason committed Jun 5, 2019
1 parent 42b5413 commit 33c61f7
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions store/tikv/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ package tikv
import (
"context"
"io"
"math"
"strconv"
"sync"
"sync/atomic"
Expand All @@ -42,11 +43,11 @@ import (

// MaxSendMsgSize set max gRPC request message size sent to server. If any request message size is larger than
// current value, an error will be reported from gRPC.
var MaxSendMsgSize = 1<<31 - 1
var MaxSendMsgSize = 10 * 1024 * 1024

// MaxCallMsgSize set max gRPC receive message size received from server. If any message size is larger than
// MaxRecvMsgSize set max gRPC receive message size received from server. If any message size is larger than
// current value, an error will be reported from gRPC.
var MaxCallMsgSize = 1<<31 - 1
var MaxRecvMsgSize = math.MaxInt64

// Timeout durations.
const (
Expand Down Expand Up @@ -258,7 +259,7 @@ func (a *connArray) Init(addr string, security config.Security) error {
grpc.WithInitialConnWindowSize(grpcInitialConnWindowSize),
grpc.WithUnaryInterceptor(unaryInterceptor),
grpc.WithStreamInterceptor(streamInterceptor),
grpc.WithDefaultCallOptions(grpc.MaxCallRecvMsgSize(MaxCallMsgSize)),
grpc.WithDefaultCallOptions(grpc.MaxCallRecvMsgSize(MaxRecvMsgSize)),
grpc.WithDefaultCallOptions(grpc.MaxCallSendMsgSize(MaxSendMsgSize)),
grpc.WithBackoffMaxDelay(time.Second*3),
grpc.WithKeepaliveParams(keepalive.ClientParameters{
Expand Down

0 comments on commit 33c61f7

Please sign in to comment.