Commit Graph

12 Commits

Author SHA1 Message Date
张可10140699 e802cf6daf remove duplicate getAttrsFunc calls to reduce temporary memory allocations
Kubernetes-commit: 479ff5a02b026caec40e8262785e8ffffb42085a
2025-01-15 10:15:02 +08:00
Eric Lin 9cab6e4eee cacher: apply key for initial events
For case of SendInitialEvents, a buffer of objects is created. That
process takes a significant amount of memory and CPU when the resource
is of a large volume. Many objects may be not relevant when key is provided.
This commit applies key when composing the buffer for SendInitialEvents.

Signed-off-by: Eric Lin <exlin@google.com>

Kubernetes-commit: d9c6c8aa5047d724e0ebc8907f5fee4b10012ae3
2024-05-04 10:46:02 +00:00
Lukasz Szaszkiewicz dcdc23d1b3 apiserver/storage/cacher: decrease running time of TestCacheWatcherDrainingNoBookmarkAfterResourceVersionReceived
before:
go test -v -race -count 1 -run ^TestCacheWatcherDrainingNoBookmarkAfterResourceVersionReceived$
ok  	k8s.io/apiserver/pkg/storage/cacher	3.792s

after:
go test -v -race -count 1 -run ^TestCacheWatcherDrainingNoBookmarkAfterResourceVersionReceived$
ok  	k8s.io/apiserver/pkg/storage/cacher	1.783s

Kubernetes-commit: d21b86d53a3c4c42e41f8374e537c721251a00d2
2024-03-14 10:44:51 +01:00
Lukasz Szaszkiewicz 9bfd27dc1c apiserver/storage: use metav1.InitialEventsAnnotationKey const
Kubernetes-commit: ed2b92c3dfb7d56155021824f0d9a61609dac051
2024-03-11 11:40:21 +01:00
tao.yang 47998d1ee6 cleanup: omit comparison with bool constants
Signed-off-by: tao.yang <tao.yang@daocloud.io>

Kubernetes-commit: b35357b6c08f21ba0fd312536051394c2567ec79
2023-09-04 16:59:23 +08:00
Wojciech Tyczyński d9c1a1d082 Refactor some watchcache tests
Kubernetes-commit: 1eca720dcc727b5deeeeb1164689d42c6cc316eb
2023-04-27 11:59:33 +02:00
Lukasz Szaszkiewicz 55dd2b5223 cacher avoid double locking (#117410)
* cacher: remove locking from watcherBookmarkTimeBuckets

it turns out that the watcherBookmarkTimeBuckets
is called from only three places/methods: startDispatching, finishDispatching and Watch.
All these methods acquire c.Lock() before touching watcherBookmarkTimeBuckets.

Thus we could remove explicit locking in
watcherBookmarkTimeBuckets since the access is already synced.

* cacher: rename watcherBookmarkTimeBuckets methods to indicate that proper synchronisation must be used

Kubernetes-commit: eab66a687b282266f0520b79166f7f55828ffd28
2023-04-19 15:13:11 +02:00
Tim Hockin 0165503c5a Replace uses of ObjectReflectDiff with cmp.Diff
ObjectReflectDiff is already a shim over cmp.Diff, so no actual output
or behavior changes

Kubernetes-commit: bc302fa4144d21a338683cd83701661f97be4aba
2023-03-23 11:34:03 -07:00
Wojciech Tyczyński 6cab3e1a4b Fix setting resource version after init events for RV=0 case
Kubernetes-commit: 6fb59e94a31cc0288c861e791e5b6e3d9903ca84
2023-03-03 13:22:13 +01:00
Lukasz Szaszkiewicz afa398f4bd cacher_watcher: Add support for consistent streaming
design details https://github.com/kubernetes/enhancements/tree/master/keps/sig-api-machinery/3157-watch-list#design-details

Kubernetes-commit: 52ce41a2939f1f4e8d9bf44e42b5d07eb1e16259
2023-02-27 13:32:49 +01:00
Antonio Ojea 33153a1931 cacher allow context cancellation if not ready (#116024)
* cacher allow context cancellation if not ready

Replace the sync.Cond variable with a channel so we can use the
context cancellation signal.

Co-authored-by: Wojciech Tyczy<C5><84>ski <wojtekt@google.com>
Change-Id: I2f75313a6337feee440ece4c1e873c32a12560dd

* wait again on pending state

Change-Id: I1ad79253a5a5d56a4d9611125825b1f7ad552be8

---------

Co-authored-by: Wojciech Tyczy<C5><84>ski <wojtekt@google.com>

Kubernetes-commit: 3b17aece1fa492e98aa82b948597b3641961195f
2023-02-28 11:23:16 +00:00
Wojciech Tyczyński a80b028565 Split cacheWatcher into its own file
Kubernetes-commit: a53704911047b87d0960cabab7889ce92f48b79e
2023-02-24 11:59:01 +01:00