Merge pull request #105573 from sttts/sttts-etcd-storage-free-kv-early

apiserver/storage: free etcd kv early in list decoding loop
This commit is contained in:
Kubernetes Prow Robot 2021-10-08 09:39:11 -07:00 committed by GitHub
commit f6facec054
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -763,7 +763,7 @@ func (s *store) List(ctx context.Context, key string, opts storage.ListOptions,
}
// take items from the response until the bucket is full, filtering as we go
for _, kv := range getResp.Kvs {
for i, kv := range getResp.Kvs {
if paging && int64(v.Len()) >= pred.Limit {
hasMore = true
break
@ -779,6 +779,9 @@ func (s *store) List(ctx context.Context, key string, opts storage.ListOptions,
return err
}
numEvald++
// free kv early. Long lists can take O(seconds) to decode.
getResp.Kvs[i] = nil
}
// indicate to the client which resource version was returned