Compact watch cache based on last observed etcd compaction#132876
Conversation
|
This issue is currently awaiting triage. If a SIG or subproject determines this is a relevant issue, they will accept it by applying the The DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
7c1b2b5 to
b484074
Compare
jpbetz
left a comment
There was a problem hiding this comment.
A few suggestions, LGTM after those are cleared.
| if err != nil { | ||
| return compactRev, currentRev, fmt.Errorf("get %q failed: %w", compactRevKey, err) | ||
| } | ||
| if len(resp.Kvs) != 0 { |
There was a problem hiding this comment.
If this condition evaluates to false, it looks like compactRev will be zero valued for the following code (lines 289-). Is that safe?
There was a problem hiding this comment.
Yes, until we read the value, the initial compaction revision is set to 0, so all the code was written to handle 0. Also the compaction revision is expected to always increase, so we always take max(current, new). This is to prevent races between TXN and Watch.
b484074 to
debefb7
Compare
debefb7 to
bfeaae3
Compare
|
LGTM label has been added. DetailsGit tree hash: 54202f7aa42f2d5cb186a36096255aa5af348013 |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: jpbetz, serathius The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
/retest |
The apiserver now watches the compact rev key and prunes caches based on the compact revision. Ref: kubernetes/kubernetes#132876 Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
The apiserver now watches the compact rev key and prunes caches based on the compact revision. Ref: kubernetes/kubernetes#132876 Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
The apiserver now watches the compact rev key and prunes caches based on the compact revision. Ref: kubernetes/kubernetes#132876 Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
The apiserver now watches the compact rev key and prunes caches based on the compact revision. Ref: kubernetes/kubernetes#132876 Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
|
@serathius Here is a case: the apiserver compaction disabled by --etcd-compaction-interval=0, and using etcd with --auto-compaction-retention=5m to compact the etcd data. This pr can not fix #131011 entirely in the comformance test. Do you have any good idea? |
|
There is currently no good way get compaction revision from etcd, that's why we depend on k8s compaction to compact watch cache. There was no movement with #80513 to fully migrate K8s to etcd managed compaction. You can still configure |
The apiserver now watches the compact rev key and prunes caches based on the compact revision. Ref: kubernetes/kubernetes#132876 Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
/kind feature
This PR adds a watch to the etcd compactor to monitor compaction done by other apiservers and adds a compactor to watch cache that every 15 seconds reads compaction revision from etcd compactor and compacts snapshots.
Ref kubernetes/enhancements#4988
Note; after merging this PR we will be reverting kubernetes/test-infra#34587 to re-enable conformance tests for compaction.
/assign @jpbetz