Skip to content

Commit edb39d3

Browse files
committed
*: fix the max recv message size for the client (tikv#1952)
Signed-off-by: Ryan Leung <rleungx@gmail.com>
1 parent 6b7dc03 commit edb39d3

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

pkg/grpcutil/grpcutil.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import (
2525
)
2626

2727
// GetClientConn returns a gRPC client connection.
28-
func GetClientConn(addr string, caPath string, certPath string, keyPath string) (*grpc.ClientConn, error) {
28+
func GetClientConn(addr string, caPath string, certPath string, keyPath string, do ...grpc.DialOption) (*grpc.ClientConn, error) {
2929
opt := grpc.WithInsecure()
3030
if len(caPath) != 0 {
3131
certificates := []tls.Certificate{}
@@ -61,7 +61,7 @@ func GetClientConn(addr string, caPath string, certPath string, keyPath string)
6161
if err != nil {
6262
return nil, errors.WithStack(err)
6363
}
64-
cc, err := grpc.Dial(u.Host, opt)
64+
cc, err := grpc.Dial(u.Host, append(do, opt)...)
6565
if err != nil {
6666
return nil, errors.WithStack(err)
6767
}

server/region_syncer/client.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import (
2323
"github.com/pingcap/pd/server/core"
2424
"github.com/pkg/errors"
2525
"go.uber.org/zap"
26+
"google.golang.org/grpc"
2627
"google.golang.org/grpc/codes"
2728
"google.golang.org/grpc/status"
2829
)
@@ -51,7 +52,7 @@ func (s *RegionSyncer) reset() {
5152
func (s *RegionSyncer) establish(addr string) (ClientStream, error) {
5253
s.reset()
5354

54-
cc, err := grpcutil.GetClientConn(addr, s.securityConfig["caPath"], s.securityConfig["certPath"], s.securityConfig["keyPath"])
55+
cc, err := grpcutil.GetClientConn(addr, s.securityConfig["caPath"], s.securityConfig["certPath"], s.securityConfig["keyPath"], grpc.WithDefaultCallOptions(grpc.MaxCallRecvMsgSize(msgSize)))
5556
if err != nil {
5657
return nil, errors.WithStack(err)
5758
}

0 commit comments

Comments
 (0)