diff --git a/drainer/util.go b/drainer/util.go index 3f61f7657..ec9d85a61 100644 --- a/drainer/util.go +++ b/drainer/util.go @@ -44,7 +44,9 @@ import ( const ( maxKafkaMsgSize = 1 << 30 - maxGrpcMsgSize = int(^uint(0) >> 1) + // max grpc message size, leave 4MB as buffer. Because when grpc decompresses messages, it will leave a few buffer + // for this, which overflows the int64: https://github.com/grpc/grpc-go/blob/v1.44.0/rpc_util.go#L742 + maxGrpcMsgSize = int(^uint(0)>>1) - 4*1024*1024 ) // taskGroup is a wrapper of `sync.WaitGroup`. diff --git a/pump/config.go b/pump/config.go index ced2cfdd6..313cc6a9b 100644 --- a/pump/config.go +++ b/pump/config.go @@ -32,10 +32,12 @@ import ( ) const ( - defaultEtcdDialTimeout = 5 * time.Second - defaultEtcdURLs = "http://127.0.0.1:2379" - defaultListenAddr = "127.0.0.1:8250" - defaultMaxMsgSize = int(^uint(0) >> 1) // max grpc message size + defaultEtcdDialTimeout = 5 * time.Second + defaultEtcdURLs = "http://127.0.0.1:2379" + defaultListenAddr = "127.0.0.1:8250" + // max grpc message size, leave 4MB as buffer. Because when grpc decompresses messages, it will leave a few buffer + // for this, which overflows the int64: https://github.com/grpc/grpc-go/blob/v1.44.0/rpc_util.go#L742 + defaultMaxMsgSize = int(^uint(0)>>1) - 4*1024*1024 defaultHeartbeatInterval = 2 defaultGC = "7" defaultDataDir = "data.pump" diff --git a/tests/cache_table/run.sh b/tests/cache_table/run.sh index 0c2696df0..48ae47eda 100644 --- a/tests/cache_table/run.sh +++ b/tests/cache_table/run.sh @@ -4,7 +4,7 @@ set -e cd "$(dirname "$0")" -run_drainer & +run_drainer --compressor gzip & sleep 3