-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Fix gc: delete revision in correct orderer #12752
Conversation
Signed-off-by: zhangchao <[email protected]>
Hi @Taction. Thanks for your PR. I'm waiting for a knative member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions 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/test-infra repository. |
/ok-to-test |
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.
Will wait for the CI to run to give a proper review, but anecdotally I ran the "Steps to Reproduce the Problem" from the linked issue and after GC only the proper revisions remained
Make sure the following and this issue will appear every time: The reason is the following code will not make the revs in reverse order as expected. |
We should add a unit test for the erroneous case |
@dprotaso Thanks for your review. Any suggestions about which tests need to be improved or which these tests should be placed? |
Signed-off-by: zhangchao <[email protected]>
Signed-off-by: zhangchao <[email protected]>
Codecov Report
@@ Coverage Diff @@
## main #12752 +/- ##
==========================================
+ Coverage 87.31% 87.44% +0.13%
==========================================
Files 196 196
Lines 9750 9760 +10
==========================================
+ Hits 8513 8535 +22
+ Misses 952 937 -15
- Partials 285 288 +3
Continue to review full report at Codecov.
|
pkg/reconciler/gc/gc.go
Outdated
// This situation should not appear in most cases, so performance here is not a big concern. | ||
if i > staleCount { | ||
for j := i; j > staleCount; j-- { | ||
revs[j] = revs[j-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.
FYI - there's no test coverage of this movement/shift
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 wonder if all this shifting logic could be simpler if we just let the array be sparse
ie. null out the entry and skip over them further down when pruning max revisions
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.
Yes! This makes sense. Done.
Signed-off-by: zhangchao <[email protected]>
/lgtm thanks for the PR 🎉 |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: dprotaso, Taction 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 |
Fixes #12341
Proposed Changes
First, delete stale revision until only
min
revision is left or all stale revision has been deleted.Then, if the count of non-stale revision is greater than
max
, delete extra older revisions past max.Release Note