Skip to content

Commit a20abdb

Browse files
committed
cacher: dispatchEvents is synced to watchCache.listResourceVersion
The internal informer populates the RV as soon as it conducts The first successful sync with the underlying store. The cache must wait until this first sync is completed to be deemed ready. Since we cannot send a bookmark when the lastProcessedResourceVersion is 0, we poll aggressively for the first list RV before entering the dispatch loop.
1 parent 2d8a3ad commit a20abdb

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

staging/src/k8s.io/apiserver/pkg/storage/cacher/cacher.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -912,10 +912,10 @@ func (c *Cacher) dispatchEvents() {
912912
// The first successful sync with the underlying store.
913913
// The cache must wait until this first sync is completed to be deemed ready.
914914
// Since we cannot send a bookmark when the lastProcessedResourceVersion is 0,
915-
// we poll aggressively for the first RV before entering the dispatch loop.
915+
// we poll aggressively for the first list RV before entering the dispatch loop.
916916
lastProcessedResourceVersion := uint64(0)
917917
if err := wait.PollUntilContextCancel(wait.ContextForChannel(c.stopCh), 10*time.Millisecond, true, func(_ context.Context) (bool, error) {
918-
if rv := c.watchCache.getResourceVersion(); rv != 0 {
918+
if rv := c.watchCache.getListResourceVersion(); rv != 0 {
919919
lastProcessedResourceVersion = rv
920920
return true, nil
921921
}

staging/src/k8s.io/apiserver/pkg/storage/cacher/watch_cache.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -644,10 +644,10 @@ func (w *watchCache) Resync() error {
644644
return nil
645645
}
646646

647-
func (w *watchCache) getResourceVersion() uint64 {
647+
func (w *watchCache) getListResourceVersion() uint64 {
648648
w.RLock()
649649
defer w.RUnlock()
650-
return w.resourceVersion
650+
return w.listResourceVersion
651651
}
652652

653653
func (w *watchCache) currentCapacity() int {

0 commit comments

Comments
 (0)