-
Notifications
You must be signed in to change notification settings - Fork 40k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Honor starting resourceVersion in watch cache #24208
Honor starting resourceVersion in watch cache #24208
Conversation
I'd like to add a unit test for this but I've got a question about it at #24194 (comment) |
@@ -555,6 +555,10 @@ func (c *cacheWatcher) process(initEvents []watchCacheEvent) { | |||
if !ok { | |||
return | |||
} | |||
if event.ResourceVersion <= resourceVersion { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we just make the send conditional?
// only send events newer than resourceVersion
if event.ResourceVersion > resourceVersion {
c.sendWatchCacheEvent(event)
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure
edd8c91
to
1703d32
Compare
Labelling this PR as size/S |
GCE e2e build/test passed for commit edd8c916d1fe65b75da23567ee419384e9d0e8ae. |
GCE e2e build/test failed for commit 1703d32c2edbfc40edab8d00cbe7e5e5fcc374fe. Please reference the list of currently known flakes when examining this failure. If you request a re-test, you must reference the issue describing the flake. |
Are there a positive and negative checks in the tests for this? |
Code changes LGTM - we just need some test for it. |
@timothysc will have units for it - just need to figure out how to write them w/o having them flake or take 30+ seconds |
@timothysc - see #24194 for discussion about test |
GCE e2e build/test passed for commit 1703d32c2edbfc40edab8d00cbe7e5e5fcc374fe. |
podFoo := makeTestPod("foo") | ||
fooCreated := updatePod(t, etcdStorage, podFoo, nil) | ||
|
||
// Set up Watch starting at fooCreated.ResourceVersion + 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
update comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
Labelling this PR as size/M |
@timothysc test added, PTAL |
Hmm the test might still pass without my fix... investigating. |
Fixed the test. Helps if you generate events for the right etcd path :-) |
fooCreated := updatePod(t, etcdStorage, podFoo, nil) | ||
|
||
// Set up Watch starting at fooCreated.ResourceVersion + 10 | ||
rv, err := storage.ParseWatchResourceVersion(fooCreated.ResourceVersion) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this logic could probably be reduced but it's a test so whatevers... re: parse + addition + convert
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I considered that but decided to be lazy 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would do the same :)
GCE e2e build/test passed for commit 2f2ee168f96411290b19a9af3ddb283e51cc9b73. |
GCE e2e build/test passed for commit 62a2ee0450deb7b9072038643729f72f67aa1d45. |
GCE e2e build/test passed for commit 0c23527da2f423904664e5bcce309ddc69da8b68. |
case <-time.After(wait.ForeverTestTimeout): | ||
t.Errorf("timed out waiting for event") | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could nit, not going to, will let @wojtek-t decide.
@ncdc - can you please squash commits and rebase? |
Compare the requested resourceVersion to each event's resourceVersion to ensure events that occurred in the past are not sent to the client.
21f6fe0
to
049e63d
Compare
Rebased & squashed |
LGTM - thanks for fixing this! |
Removing label |
GCE e2e build/test failed for commit 21f6fe03ffc9e5a09c2bf50d6bd659e4c002c936. Please reference the list of currently known flakes when examining this failure. If you request a re-test, you must reference the issue describing the flake. |
GCE e2e build/test passed for commit 049e63d. |
@k8s-bot test this [submit-queue is verifying that this PR is safe to merge] |
GCE e2e build/test passed for commit 049e63d. |
Automatic merge from submit-queue |
…pstream-release-1.2 Automated cherry pick of #24208
…f-#24208-upstream-release-1.2 Automated cherry pick of kubernetes#24208
…f-#24208-upstream-release-1.2 Automated cherry pick of kubernetes#24208
Compare the requested resourceVersion to each event's resourceVersion to ensure events that occurred
in the past are not sent to the client.
Fixes #24194
cc @liggitt @wojtek-t