Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added go/cmd/vtgateproxy/vtgateproxy
Binary file not shown.
2 changes: 2 additions & 0 deletions go/flags/endtoend/vtbackup.txt
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ Usage of vtbackup:
--grpc_keepalive_time duration After a duration of this time, if the client doesn't see any activity, it pings the server to see if the transport is still alive. (default 10s)
--grpc_keepalive_timeout duration After having pinged for keepalive check, the client waits for a duration of Timeout and if no activity is seen even after that the connection is closed. (default 10s)
--grpc_max_message_size int Maximum allowed RPC message size. Larger messages will be rejected by gRPC with the error 'exceeding the max size'. (default 16777216)
--grpc_max_message_recv_size int Maximum allowed RPC message size when receiving. If 0, defaults to grpc_max_message_size.
--grpc_max_message_send_size int Maximum allowed RPC message size when sending. If 0, defaults to grpc_max_message_size.
--grpc_prometheus Enable gRPC monitoring with Prometheus.
-h, --help display usage and exit
--init_db_name_override string (init parameter) override the name of the db used by vttablet
Expand Down
2 changes: 2 additions & 0 deletions go/flags/endtoend/vtctlclient.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ Usage of vtctlclient:
--grpc_keepalive_time duration After a duration of this time, if the client doesn't see any activity, it pings the server to see if the transport is still alive. (default 10s)
--grpc_keepalive_timeout duration After having pinged for keepalive check, the client waits for a duration of Timeout and if no activity is seen even after that the connection is closed. (default 10s)
--grpc_max_message_size int Maximum allowed RPC message size. Larger messages will be rejected by gRPC with the error 'exceeding the max size'. (default 16777216)
--grpc_max_message_recv_size int Maximum allowed RPC message size when receiving. If 0, defaults to grpc_max_message_size.
--grpc_max_message_send_size int Maximum allowed RPC message size when sending. If 0, defaults to grpc_max_message_size.
--grpc_prometheus Enable gRPC monitoring with Prometheus.
-h, --help display usage and exit
--jaeger-agent-host string host and port to send spans to. if empty, no tracing will be done
Expand Down
2 changes: 2 additions & 0 deletions go/flags/endtoend/vtctld.txt
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ Usage of vtctld:
--grpc_max_connection_age duration Maximum age of a client connection before GoAway is sent. (default 2562047h47m16.854775807s)
--grpc_max_connection_age_grace duration Additional grace period after grpc_max_connection_age, after which connections are forcibly closed. (default 2562047h47m16.854775807s)
--grpc_max_message_size int Maximum allowed RPC message size. Larger messages will be rejected by gRPC with the error 'exceeding the max size'. (default 16777216)
--grpc_max_message_recv_size int Maximum allowed RPC message size when receiving. If 0, defaults to grpc_max_message_size.
--grpc_max_message_send_size int Maximum allowed RPC message size when sending. If 0, defaults to grpc_max_message_size.
--grpc_port int Port to listen on for gRPC calls. If zero, do not listen.
--grpc_prometheus Enable gRPC monitoring with Prometheus.
--grpc_server_ca string path to server CA in PEM format, which will be combine with server cert, return full certificate chain to clients
Expand Down
4 changes: 3 additions & 1 deletion go/flags/endtoend/vtctldclient.txt
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ Available Commands:
SetShardTabletControl Sets the TabletControl record for a shard and tablet type. Only use this for an emergency fix or after a finished MoveTables.
SetWritable Sets the specified tablet as writable or read-only.
ShardReplicationFix Walks through a ShardReplication object and fixes the first error encountered.
ShardReplicationPositions
ShardReplicationPositions
SleepTablet Blocks the action queue on the specified tablet for the specified amount of time. This is typically used for testing.
SourceShardAdd Adds the SourceShard record with the provided index for emergencies only. It does not call RefreshState for the shard primary.
SourceShardDelete Deletes the SourceShard record with the provided index. This should only be used for emergency cleanup. It does not call RefreshState for the shard primary.
Expand Down Expand Up @@ -99,6 +99,8 @@ Flags:
--grpc_keepalive_time duration After a duration of this time, if the client doesn't see any activity, it pings the server to see if the transport is still alive. (default 10s)
--grpc_keepalive_timeout duration After having pinged for keepalive check, the client waits for a duration of Timeout and if no activity is seen even after that the connection is closed. (default 10s)
--grpc_max_message_size int Maximum allowed RPC message size. Larger messages will be rejected by gRPC with the error 'exceeding the max size'. (default 16777216)
--grpc_max_message_recv_size int Maximum allowed RPC message size when receiving. If 0, defaults to grpc_max_message_size.
--grpc_max_message_send_size int Maximum allowed RPC message size when sending. If 0, defaults to grpc_max_message_size.
--grpc_prometheus Enable gRPC monitoring with Prometheus.
-h, --help help for vtctldclient
--keep_logs duration keep logs for this long (using ctime) (zero to keep forever)
Expand Down
2 changes: 2 additions & 0 deletions go/flags/endtoend/vtgate.txt
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ Usage of vtgate:
--grpc_max_connection_age duration Maximum age of a client connection before GoAway is sent. (default 2562047h47m16.854775807s)
--grpc_max_connection_age_grace duration Additional grace period after grpc_max_connection_age, after which connections are forcibly closed. (default 2562047h47m16.854775807s)
--grpc_max_message_size int Maximum allowed RPC message size. Larger messages will be rejected by gRPC with the error 'exceeding the max size'. (default 16777216)
--grpc_max_message_recv_size int Maximum allowed RPC message size when receiving. If 0, defaults to grpc_max_message_size.
--grpc_max_message_send_size int Maximum allowed RPC message size when sending. If 0, defaults to grpc_max_message_size.
--grpc_port int Port to listen on for gRPC calls. If zero, do not listen.
--grpc_prometheus Enable gRPC monitoring with Prometheus.
--grpc_server_ca string path to server CA in PEM format, which will be combine with server cert, return full certificate chain to clients
Expand Down
2 changes: 2 additions & 0 deletions go/flags/endtoend/vtgr.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ Usage of vtgr:
--grpc_keepalive_time duration After a duration of this time, if the client doesn't see any activity, it pings the server to see if the transport is still alive. (default 10s)
--grpc_keepalive_timeout duration After having pinged for keepalive check, the client waits for a duration of Timeout and if no activity is seen even after that the connection is closed. (default 10s)
--grpc_max_message_size int Maximum allowed RPC message size. Larger messages will be rejected by gRPC with the error 'exceeding the max size'. (default 16777216)
--grpc_max_message_recv_size int Maximum allowed RPC message size when receiving. If 0, defaults to grpc_max_message_size.
--grpc_max_message_send_size int Maximum allowed RPC message size when sending. If 0, defaults to grpc_max_message_size.
--grpc_prometheus Enable gRPC monitoring with Prometheus.
-h, --help display usage and exit
--keep_logs duration keep logs for this long (using ctime) (zero to keep forever)
Expand Down
2 changes: 2 additions & 0 deletions go/flags/endtoend/vtorc.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ Usage of vtorc:
--grpc_keepalive_time duration After a duration of this time, if the client doesn't see any activity, it pings the server to see if the transport is still alive. (default 10s)
--grpc_keepalive_timeout duration After having pinged for keepalive check, the client waits for a duration of Timeout and if no activity is seen even after that the connection is closed. (default 10s)
--grpc_max_message_size int Maximum allowed RPC message size. Larger messages will be rejected by gRPC with the error 'exceeding the max size'. (default 16777216)
--grpc_max_message_recv_size int Maximum allowed RPC message size when receiving. If 0, defaults to grpc_max_message_size.
--grpc_max_message_send_size int Maximum allowed RPC message size when sending. If 0, defaults to grpc_max_message_size.
--grpc_prometheus Enable gRPC monitoring with Prometheus.
-h, --help display usage and exit
--instance-poll-time duration Timer duration on which VTOrc refreshes MySQL information (default 5s)
Expand Down
2 changes: 2 additions & 0 deletions go/flags/endtoend/vttablet.txt
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,8 @@ Usage of vttablet:
--grpc_max_connection_age duration Maximum age of a client connection before GoAway is sent. (default 2562047h47m16.854775807s)
--grpc_max_connection_age_grace duration Additional grace period after grpc_max_connection_age, after which connections are forcibly closed. (default 2562047h47m16.854775807s)
--grpc_max_message_size int Maximum allowed RPC message size. Larger messages will be rejected by gRPC with the error 'exceeding the max size'. (default 16777216)
--grpc_max_message_recv_size int Maximum allowed RPC message size when receiving. If 0, defaults to grpc_max_message_size.
--grpc_max_message_send_size int Maximum allowed RPC message size when sending. If 0, defaults to grpc_max_message_size.
--grpc_port int Port to listen on for gRPC calls. If zero, do not listen.
--grpc_prometheus Enable gRPC monitoring with Prometheus.
--grpc_server_ca string path to server CA in PEM format, which will be combine with server cert, return full certificate chain to clients
Expand Down
2 changes: 2 additions & 0 deletions go/flags/endtoend/vttestserver.txt
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ Usage of vttestserver:
--grpc_max_connection_age duration Maximum age of a client connection before GoAway is sent. (default 2562047h47m16.854775807s)
--grpc_max_connection_age_grace duration Additional grace period after grpc_max_connection_age, after which connections are forcibly closed. (default 2562047h47m16.854775807s)
--grpc_max_message_size int Maximum allowed RPC message size. Larger messages will be rejected by gRPC with the error 'exceeding the max size'. (default 16777216)
--grpc_max_message_recv_size int Maximum allowed RPC message size when receiving. If 0, defaults to grpc_max_message_size.
--grpc_max_message_send_size int Maximum allowed RPC message size when sending. If 0, defaults to grpc_max_message_size.
--grpc_port int Port to listen on for gRPC calls. If zero, do not listen.
--grpc_prometheus Enable gRPC monitoring with Prometheus.
--grpc_server_ca string path to server CA in PEM format, which will be combine with server cert, return full certificate chain to clients
Expand Down
7 changes: 4 additions & 3 deletions go/vt/grpcclient/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,12 @@ func Dial(target string, failFast FailFast, opts ...grpc.DialOption) (*grpc.Clie
// what that should be.
func DialContext(ctx context.Context, target string, failFast FailFast, opts ...grpc.DialOption) (*grpc.ClientConn, error) {
grpccommon.EnableTracingOpt()
msgSize := grpccommon.MaxMessageSize()
maxSendSize := grpccommon.MaxMessageSendSize()
maxRecvSize := grpccommon.MaxMessageRecvSize()
newopts := []grpc.DialOption{
grpc.WithDefaultCallOptions(
grpc.MaxCallRecvMsgSize(msgSize),
grpc.MaxCallSendMsgSize(msgSize),
grpc.MaxCallRecvMsgSize(maxRecvSize),
grpc.MaxCallSendMsgSize(maxSendSize),
grpc.WaitForReady(bool(!failFast)),
),
}
Expand Down
20 changes: 20 additions & 0 deletions go/vt/grpccommon/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ var (
// accept. Larger messages will be rejected.
// Note: We're using 16 MiB as default value because that's the default in MySQL
maxMessageSize = 16 * 1024 * 1024
// These options override maxMessageSize if > 0, allowing us to control the max
// size sending independently from receiving.
maxMsgRecvSize = 0
maxMsgSendSize = 0
// enableTracing sets a flag to enable grpc client/server tracing.
enableTracing bool
// enablePrometheus sets a flag to enable grpc client/server grpc monitoring.
Expand All @@ -43,6 +47,8 @@ var (
// command-line arguments.
func RegisterFlags(fs *pflag.FlagSet) {
fs.IntVar(&maxMessageSize, "grpc_max_message_size", maxMessageSize, "Maximum allowed RPC message size. Larger messages will be rejected by gRPC with the error 'exceeding the max size'.")
fs.IntVar(&maxMsgSendSize, "grpc_max_message_send_size", maxMsgSendSize, "Maximum allowed RPC message size when sending. If 0, defaults to grpc_max_message_size.")
fs.IntVar(&maxMsgRecvSize, "grpc_max_message_recv_size", maxMsgRecvSize, "Maximum allowed RPC message size when receiving. If 0, defaults to grpc_max_message_size.")
fs.BoolVar(&enableTracing, "grpc_enable_tracing", enableTracing, "Enable gRPC tracing.")
fs.BoolVar(&enablePrometheus, "grpc_prometheus", enablePrometheus, "Enable gRPC monitoring with Prometheus.")
}
Expand Down Expand Up @@ -70,6 +76,20 @@ func MaxMessageSize() int {
return maxMessageSize
}

func MaxMessageRecvSize() int {
if maxMsgRecvSize > 0 {
return maxMsgRecvSize
}
return MaxMessageSize()
}

func MaxMessageSendSize() int {
if maxMsgSendSize > 0 {
return maxMsgSendSize
}
return MaxMessageSize()
}

func init() {
stats.NewString("GrpcVersion").Set(grpc.Version)
}
10 changes: 6 additions & 4 deletions go/vt/servenv/grpc_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -207,10 +207,12 @@ func createGRPCServer() {
// grpc: received message length XXXXXXX exceeding the max size 4194304
// Note: For gRPC 1.0.0 it's sufficient to set the limit on the server only
// because it's not enforced on the client side.
msgSize := grpccommon.MaxMessageSize()
log.Infof("Setting grpc max message size to %d", msgSize)
opts = append(opts, grpc.MaxRecvMsgSize(msgSize))
opts = append(opts, grpc.MaxSendMsgSize(msgSize))

maxSendSize := grpccommon.MaxMessageSendSize()
maxRecvSize := grpccommon.MaxMessageRecvSize()
log.Infof("Setting grpc server max message sizes to %d (sending), %d (receiving)", maxSendSize, maxRecvSize)
opts = append(opts, grpc.MaxRecvMsgSize(maxRecvSize))
opts = append(opts, grpc.MaxSendMsgSize(maxSendSize))

if gRPCInitialConnWindowSize != 0 {
log.Infof("Setting grpc server initial conn window size to %d", int32(gRPCInitialConnWindowSize))
Expand Down