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:
		| @@ -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 | 		// 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 { | 			if paging && int64(v.Len()) >= pred.Limit { | ||||||
| 				hasMore = true | 				hasMore = true | ||||||
| 				break | 				break | ||||||
| @@ -779,6 +779,9 @@ func (s *store) List(ctx context.Context, key string, opts storage.ListOptions, | |||||||
| 				return err | 				return err | ||||||
| 			} | 			} | ||||||
| 			numEvald++ | 			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 | 		// indicate to the client which resource version was returned | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Kubernetes Prow Robot
					Kubernetes Prow Robot