Skip to content

Commit

Permalink
*: fix the max recv message size for the client (tikv#1952)
Browse files Browse the repository at this point in the history
Signed-off-by: Ryan Leung <rleungx@gmail.com>
  • Loading branch information
rleungx committed Nov 25, 2019
1 parent 6b7dc03 commit edb39d3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions pkg/grpcutil/grpcutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (
)

// GetClientConn returns a gRPC client connection.
func GetClientConn(addr string, caPath string, certPath string, keyPath string) (*grpc.ClientConn, error) {
func GetClientConn(addr string, caPath string, certPath string, keyPath string, do ...grpc.DialOption) (*grpc.ClientConn, error) {
opt := grpc.WithInsecure()
if len(caPath) != 0 {
certificates := []tls.Certificate{}
Expand Down Expand Up @@ -61,7 +61,7 @@ func GetClientConn(addr string, caPath string, certPath string, keyPath string)
if err != nil {
return nil, errors.WithStack(err)
}
cc, err := grpc.Dial(u.Host, opt)
cc, err := grpc.Dial(u.Host, append(do, opt)...)
if err != nil {
return nil, errors.WithStack(err)
}
Expand Down
3 changes: 2 additions & 1 deletion server/region_syncer/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
"github.com/pingcap/pd/server/core"
"github.com/pkg/errors"
"go.uber.org/zap"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
)
Expand Down Expand Up @@ -51,7 +52,7 @@ func (s *RegionSyncer) reset() {
func (s *RegionSyncer) establish(addr string) (ClientStream, error) {
s.reset()

cc, err := grpcutil.GetClientConn(addr, s.securityConfig["caPath"], s.securityConfig["certPath"], s.securityConfig["keyPath"])
cc, err := grpcutil.GetClientConn(addr, s.securityConfig["caPath"], s.securityConfig["certPath"], s.securityConfig["keyPath"], grpc.WithDefaultCallOptions(grpc.MaxCallRecvMsgSize(msgSize)))
if err != nil {
return nil, errors.WithStack(err)
}
Expand Down

0 comments on commit edb39d3

Please sign in to comment.