-
Notifications
You must be signed in to change notification settings - Fork 40.9k
Handle consistent LIST in watch cache to avoid incorrect semantics while setting ResourceVersion on options #132150
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
Handle consistent LIST in watch cache to avoid incorrect semantics while setting ResourceVersion on options #132150
Conversation
5f8422a
to
3643a09
Compare
/assign @wojtek-t |
/test pull-kubernetes-conformance-kind-ga-only-parallel |
@serathius i was playing with some test cases in case you find them useful - https://paste.openstack.org/show/bzSa1WUIAn2VlRyEAo4g/ I did not understand one scenario what would/should happen (see "too high RV, exact match" - line 220->227), the test hangs if i uncomment those lines. |
/retest |
2309b58
to
0531f05
Compare
0531f05
to
307c930
Compare
/triage accepted |
307c930
to
1ca8754
Compare
1ca8754
to
4cb6d3d
Compare
4cb6d3d
to
1ca8754
Compare
PTAL @wojtek-t |
f806007
to
2421ab2
Compare
…ile setting ResourceVersion on options
2421ab2
to
292679a
Compare
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.
Thanks - this is much easier to reason about for me!
Just one minor nit - other than that LGTM
@@ -3495,7 +3495,7 @@ func TestListIndexer(t *testing.T) { | |||
for _, tt := range tests { | |||
t.Run(tt.name, func(t *testing.T) { | |||
pred := storagetesting.CreatePodPredicate(tt.fieldSelector, true, tt.indexFields) | |||
_, usedIndex, err := cacher.cacher.listItems(ctx, 0, "/pods/"+tt.requestedNamespace, storage.ListOptions{Predicate: pred, Recursive: tt.recursive}) | |||
_, usedIndex, err := cacher.cacher.watchCache.WaitUntilFreshAndGetList(ctx, "/pods/"+tt.requestedNamespace, storage.ListOptions{Predicate: pred, Recursive: tt.recursive}) |
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.
nit: let use cacher.cache.List(ctx, ...)
instead?
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.
cacher.cache.GetList(ctx, ...)
doesn't return Index used. We could create dedicated function for that on cacher, however at this point this is more watchCache test that also validates if cacher passes the Index config to watchCache correctly.
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 see. Let's leave as is then.
/lgtm |
LGTM label has been added. Git tree hash: 84e45cf6a6801d7ccc020782044305cc576d703c
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: serathius, wojtek-t The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/kind cleanup
Cleanup after discovery of #132132 and fix #132244
This PR should make the code easier to understand.
Due to Snapshots from cache feature the watch cache started classifying consistent read with limit as legacy exact read. This is because the delegator incorrectly assumed that it can transform consistent read to notOlderThan request.