From 96bf3fd98d422c4c0f051cc807058086f6b4f170 Mon Sep 17 00:00:00 2001 From: Xiang Date: Thu, 1 Feb 2018 15:01:09 -0800 Subject: [PATCH] etcd: config etcd3 client's max response size --- physical/etcd/etcd3.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/physical/etcd/etcd3.go b/physical/etcd/etcd3.go index 2495e6f5fe3f..e50f01d7b343 100644 --- a/physical/etcd/etcd3.go +++ b/physical/etcd/etcd3.go @@ -113,6 +113,15 @@ func newEtcd3Backend(conf map[string]string, logger log.Logger) (physical.Backen cfg.Password = password } + if maxReceive, ok := conf["max_receive_size"]; ok { + // grpc converts this to uint32 internally, so parse as that to avoid passing invalid values + val, err := strconv.ParseUint(maxReceive, 10, 32) + if err != nil { + return nil, fmt.Errorf("value [%v] of 'max_receive_size' could not be understood", maxReceive) + } + cfg.MaxCallRecvMsgSize = int(val) + } + etcd, err := clientv3.New(cfg) if err != nil { return nil, err