Skip to content

Commit

Permalink
Merge pull request kubernetes#105573 from sttts/sttts-etcd-storage-fr…
Browse files Browse the repository at this point in the history
…ee-kv-early

apiserver/storage: free etcd kv early in list decoding loop
  • Loading branch information
k8s-ci-robot authored Oct 8, 2021
2 parents 76c86ce + dbf98e4 commit f6facec
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion staging/src/k8s.io/apiserver/pkg/storage/etcd3/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit f6facec

Please sign in to comment.