-
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
Avoid unnecessary decoding in etcd3 client #34435
Avoid unnecessary decoding in etcd3 client #34435
Conversation
Jenkins GCE Node e2e failed for commit 7f63c5d. Full PR test history. The magic incantation to run this job again is |
@@ -52,6 +52,7 @@ type watchChan struct { | |||
initialRev int64 | |||
recursive bool | |||
filter storage.FilterFunc | |||
filterAcceptsAll bool |
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.
do we need this additional field? can we simply set filter to nil if we accept everything?
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.
basically (wc *watchChan) acceptAll bool (return wc.filter == nil)
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.
Well - that would mean that whenever we are accessing wc.filter, we need to check whether it is nil or not. This will complicate the code in my opinion.
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.
@wojtek-t transform is not the only place we access it? if not, i agree.
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.
transform is the only place, but there are 4 places in transform...
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 might be overkill, but still want to bring it up.
we can add another layer of abstraction to get rid of the duplicated field.
wc.filter() {
if wc.internalFilter == nil{
...
}
wc.internalFilter()
}
wc.acceptAll {return wc.internalFilter == nil}
this is totally up to you though. not blocking issue.
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.
OK - if you think it's worth it, I can change that tomorrow.
res = &watch.Event{ | ||
Type: watch.Modified, | ||
Object: curObj, | ||
} | ||
case curObjPasses && !oldObjPasses: |
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 feel we have too many indentations here. can we return directly in this case and remove the else at line 267?
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.
done
The idea looks good to me. @hongchaodeng Can you also take a look? |
7f63c5d
to
fe706bb
Compare
Jenkins GCI GCE e2e failed for commit fe706bb0d9f1ab0923ef459e98bc2341a96fcf15. Full PR test history. The magic incantation to run this job again is |
The approach lgtm. |
fe706bb
to
b675b22
Compare
@xiang90 @hongchaodeng - comments applied. PTAL |
Jenkins Kubemark GCE e2e failed for commit b675b22. Full PR test history. The magic incantation to run this job again is |
@k8s-bot gce e2e test this, issue: #IGNORE (firewall quota) |
@k8s-bot kubemark test this, issue: #IGNORE (gcloud auth issues) |
@k8s-bot gce e2e test this, issue: #IGNORE (firewall quota) |
1 similar comment
@k8s-bot gce e2e test this, issue: #IGNORE (firewall quota) |
/lgtm |
@k8s-bot gce e2e test this, issue: #IGNORE (previous run didn't start) |
Jenkins GCE e2e failed for commit b675b22. Full PR test history. The magic incantation to run this job again is |
@k8s-bot test this [submit-queue is verifying that this PR is safe to merge] |
Automatic merge from submit-queue |
Removing label |
#31704-#32831-#32907-#33003-#33349-#31190-#33581-#34089-#34234-#32822-#33393-#34246-#34435-#32477-upstream-release-1.4 Automatic merge from submit-queue Automated cherry pick of #31189 #31704 #32831 #32907 #33003 #33349 #31190 #33581 #34089 #34234 #32822 #33393 #34246 #34435 #32477 upstream release 1.4 We are going to release etcd v3 in 1.4.x release. ``` Cherrypick etcd v3-related bug fixes to 1.4 branch ``` Those PRs include: - Updates of etcd Godeps - Update to pkg/storage/etcd directory - Two PR that were unnecessary to avoid conflicts: #31189 #31704 Automated cherry pick of #31189 #31704 #32831 #32907 #33003 #33349 #31190 #33581 #34089 #34234 #32822 #33393 #34246 #34435 #32477 @hongchaodeng @xiang90 @lavalamp @smarterclayton
Commit found in the "release-1.4" branch appears to be this PR. Removing the "cherrypick-candidate" label. If this is an error find help to get your PR picked. |
…ck-of-#31189-kubernetes#31704-kubernetes#32831-kubernetes#32907-kubernetes#33003-kubernetes#33349-kubernetes#31190-kubernetes#33581-kubernetes#34089-kubernetes#34234-kubernetes#32822-kubernetes#33393-kubernetes#34246-kubernetes#34435-kubernetes#32477-upstream-release-1.4 Automatic merge from submit-queue Automated cherry pick of kubernetes#31189 kubernetes#31704 kubernetes#32831 kubernetes#32907 kubernetes#33003 kubernetes#33349 kubernetes#31190 kubernetes#33581 kubernetes#34089 kubernetes#34234 kubernetes#32822 kubernetes#33393 kubernetes#34246 kubernetes#34435 kubernetes#32477 upstream release 1.4 We are going to release etcd v3 in 1.4.x release. ``` Cherrypick etcd v3-related bug fixes to 1.4 branch ``` Those PRs include: - Updates of etcd Godeps - Update to pkg/storage/etcd directory - Two PR that were unnecessary to avoid conflicts: kubernetes#31189 kubernetes#31704 Automated cherry pick of kubernetes#31189 kubernetes#31704 kubernetes#32831 kubernetes#32907 kubernetes#33003 kubernetes#33349 kubernetes#31190 kubernetes#33581 kubernetes#34089 kubernetes#34234 kubernetes#32822 kubernetes#33393 kubernetes#34246 kubernetes#34435 kubernetes#32477 @hongchaodeng @xiang90 @lavalamp @smarterclayton
Ref #33653
With the "Cacher" layer in Kubernetes, most of the watches processed by "pkg/storage/etcd3/watcher.go" have "filter = Everything()". That said, we generally don't need to decode previous value of the object (which is used only to get the value of filter of it), because we already know it will be true.
This PR is basically fixing this problem.
Should be merged after #34246
This change is