aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lu <chris.lu@gmail.com>2020-04-05 21:48:45 -0700
committerChris Lu <chris.lu@gmail.com>2020-04-05 21:48:45 -0700
commit5a5908407d74437bea1a5bdeaa429ccc30d5d27c (patch)
tree4d7e6428548c4d1bc34947225d98922ad43221cc
parent19edd9c0919fec73aa30b97d4fffcd4d12f5ad0f (diff)
downloadseaweedfs-5a5908407d74437bea1a5bdeaa429ccc30d5d27c.tar.xz
seaweedfs-5a5908407d74437bea1a5bdeaa429ccc30d5d27c.zip
filer: support larger file size
fix https://github.com/chrislusf/seaweedfs/issues/1257
-rw-r--r--weed/pb/grpc_client_server.go27
1 files changed, 20 insertions, 7 deletions
diff --git a/weed/pb/grpc_client_server.go b/weed/pb/grpc_client_server.go
index 4b5f9eff3..8960a333c 100644
--- a/weed/pb/grpc_client_server.go
+++ b/weed/pb/grpc_client_server.go
@@ -16,6 +16,10 @@ import (
"github.com/chrislusf/seaweedfs/weed/pb/master_pb"
)
+const (
+ Max_Message_Size = 1 << 30 // 1 GB
+)
+
var (
// cache grpc connections
grpcClients = make(map[string]*grpc.ClientConn)
@@ -28,13 +32,18 @@ func init() {
func NewGrpcServer(opts ...grpc.ServerOption) *grpc.Server {
var options []grpc.ServerOption
- options = append(options, grpc.KeepaliveParams(keepalive.ServerParameters{
- Time: 10 * time.Second, // wait time before ping if no activity
- Timeout: 20 * time.Second, // ping timeout
- }), grpc.KeepaliveEnforcementPolicy(keepalive.EnforcementPolicy{
- MinTime: 60 * time.Second, // min time a client should wait before sending a ping
- PermitWithoutStream: true,
- }))
+ options = append(options,
+ grpc.KeepaliveParams(keepalive.ServerParameters{
+ Time: 10 * time.Second, // wait time before ping if no activity
+ Timeout: 20 * time.Second, // ping timeout
+ }),
+ grpc.KeepaliveEnforcementPolicy(keepalive.EnforcementPolicy{
+ MinTime: 60 * time.Second, // min time a client should wait before sending a ping
+ PermitWithoutStream: true,
+ }),
+ grpc.MaxRecvMsgSize(Max_Message_Size),
+ grpc.MaxSendMsgSize(Max_Message_Size),
+ )
for _, opt := range opts {
if opt != nil {
options = append(options, opt)
@@ -49,6 +58,10 @@ func GrpcDial(ctx context.Context, address string, opts ...grpc.DialOption) (*gr
var options []grpc.DialOption
options = append(options,
// grpc.WithInsecure(),
+ grpc.WithDefaultCallOptions(
+ grpc.MaxCallSendMsgSize(Max_Message_Size),
+ grpc.MaxCallRecvMsgSize(Max_Message_Size),
+ ),
grpc.WithKeepaliveParams(keepalive.ClientParameters{
Time: 30 * time.Second, // client ping server if no activity for this long
Timeout: 20 * time.Second,