From 6a22114a8f814c14b3f58425002858993cf1d40e Mon Sep 17 00:00:00 2001 From: Xiang Li Date: Thu, 1 Feb 2018 16:08:09 -0800 Subject: [PATCH] etcd: config etcd3 client's max response size (#3891) --- physical/etcd/etcd3.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/physical/etcd/etcd3.go b/physical/etcd/etcd3.go index dac9329e4fc0..cd244ce8ae08 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