Merge pull request #11325 from lijianwh/#11320_fix_bug

etcdserver: fix a bug which append object to a new allocated sized slice
This commit is contained in:
Gyuho Lee 2019-11-02 10:18:53 -07:00 committed by GitHub
commit edd011c6d1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -313,7 +313,7 @@ func (s *EtcdServer) getPeerHashKVs(rev int64) (resps []*peerHashKVResp) {
// TODO: handle the case when "s.cluster.Members" have not
// been populated (e.g. no snapshot to load from disk)
mbs := s.cluster.Members()
pss := make([]peerHashKVResp, len(mbs))
pss := make([]peerHashKVResp, 0, len(mbs))
for _, m := range mbs {
if m.ID == s.ID() {
continue