-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Consistent reads mitigation #4608
Consistent reads mitigation #4608
Conversation
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 also propagated table for watch requests.
I largely agree with @wojtek-t. After further consideration, I don't think a dedicated "SkipCache" API option is necessary in this scenario. We shouldn't view watchcache as a traditional database cache like memcache or varnish. Skipping cache for debugging purposes is suitable for periodically refreshed and invalidated caches to identify corrupted data. It operates under the expectation of consistent results. However, in distributed systems, it's normal to receive different results from concurrent consistent read requests. In distributed systems like etcd, two concurrent read requests can target different instances, leading to different pathing and arbitrary network delays, allowing for interleaved transactions and reordering. The only way to determine their "real" execution order is by checking the revision returned by etcd. Responses from two different reads should only match when they have the same revision. However, even in medium-sized clusters, there's enough traffic that two concurrent consistent read requests will often return different revisions. To better understand that I recommend reading https://jepsen.io/consistency/models/linearizable The only way to debug watch cache corruption is to verify if the cached data matches the data in etcd. If you want to use the K8s API for this, the only way is to make two requests that share the same ResourceVersion (RV). This means the correct flow to compare watchcache state to etcd state is:
|
My view on this case is that instead of adding a new list option that allows bypassing the cache, we should better test the feature before enabling it globally. Mainly, my concern is that today, when the feature Additionally, as @serathius mentioned, we should (especially in CI) have a mechanism for detecting inconsistencies in data by comparing data returned from the cache and directly from etcd. For that we could use the data_consistency_detector by issuing two request to the server. |
9f92967
to
41381be
Compare
Thank you @wojtek-t and @serathius for taking the time to put together the list, describe the potential debugging flows, and answer questions live. I think I've reached where you are: we should not create a new option for bypassing the watch cache. While it seems congruent to add a parameter for "bypass watch cache" and it could be useful if the watch cache is misbehaving, such an option is not useful for debugging answers from the watch cache. This is because the wache cache cannot support This means that the only debugging flow available is make a watch cache request and then use the existing option
|
5612885
to
9cacba8
Compare
@deads2k - I updated the PR to reflect our discussion today, PTAL |
9cacba8
to
9afa3e0
Compare
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: deads2k, 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 |
Awesome! |
Ref #2340
/cc @serathius @deads2k