mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
filer: support larger file size
fix https://github.com/chrislusf/seaweedfs/issues/1257
This commit is contained in:
parent
19edd9c091
commit
5a5908407d
|
@ -16,6 +16,10 @@ import (
|
||||||
"github.com/chrislusf/seaweedfs/weed/pb/master_pb"
|
"github.com/chrislusf/seaweedfs/weed/pb/master_pb"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
Max_Message_Size = 1 << 30 // 1 GB
|
||||||
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
// cache grpc connections
|
// cache grpc connections
|
||||||
grpcClients = make(map[string]*grpc.ClientConn)
|
grpcClients = make(map[string]*grpc.ClientConn)
|
||||||
|
@ -28,13 +32,18 @@ func init() {
|
||||||
|
|
||||||
func NewGrpcServer(opts ...grpc.ServerOption) *grpc.Server {
|
func NewGrpcServer(opts ...grpc.ServerOption) *grpc.Server {
|
||||||
var options []grpc.ServerOption
|
var options []grpc.ServerOption
|
||||||
options = append(options, grpc.KeepaliveParams(keepalive.ServerParameters{
|
options = append(options,
|
||||||
Time: 10 * time.Second, // wait time before ping if no activity
|
grpc.KeepaliveParams(keepalive.ServerParameters{
|
||||||
Timeout: 20 * time.Second, // ping timeout
|
Time: 10 * time.Second, // wait time before ping if no activity
|
||||||
}), grpc.KeepaliveEnforcementPolicy(keepalive.EnforcementPolicy{
|
Timeout: 20 * time.Second, // ping timeout
|
||||||
MinTime: 60 * time.Second, // min time a client should wait before sending a ping
|
}),
|
||||||
PermitWithoutStream: true,
|
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 {
|
for _, opt := range opts {
|
||||||
if opt != nil {
|
if opt != nil {
|
||||||
options = append(options, opt)
|
options = append(options, opt)
|
||||||
|
@ -49,6 +58,10 @@ func GrpcDial(ctx context.Context, address string, opts ...grpc.DialOption) (*gr
|
||||||
var options []grpc.DialOption
|
var options []grpc.DialOption
|
||||||
options = append(options,
|
options = append(options,
|
||||||
// grpc.WithInsecure(),
|
// grpc.WithInsecure(),
|
||||||
|
grpc.WithDefaultCallOptions(
|
||||||
|
grpc.MaxCallSendMsgSize(Max_Message_Size),
|
||||||
|
grpc.MaxCallRecvMsgSize(Max_Message_Size),
|
||||||
|
),
|
||||||
grpc.WithKeepaliveParams(keepalive.ClientParameters{
|
grpc.WithKeepaliveParams(keepalive.ClientParameters{
|
||||||
Time: 30 * time.Second, // client ping server if no activity for this long
|
Time: 30 * time.Second, // client ping server if no activity for this long
|
||||||
Timeout: 20 * time.Second,
|
Timeout: 20 * time.Second,
|
||||||
|
|
Loading…
Reference in a new issue