-
Notifications
You must be signed in to change notification settings - Fork 159
Use original error code when backing off #1298
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
Conversation
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: mattcary 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 |
pkg/gce-pd-csi-driver/controller.go
Outdated
b.backoff.Next(string(id), b.backoff.Clock.Now()) | ||
if code != 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.
code != nil
will only happen when the error passed to CodeForError
in next(backoffId, common.CodeForError(err))
is nil. In CodeForError, we default to Internal error codes when the error cannot be converted to a user error. See CodeForError, so I don't think your code is doing what you want.
Just a thought: CodeForError returns a pointer because it wasn't always used within an err != nil statement. Now that CodeForError is only called from LoggedError, and LoggedError clearly is logging an error, then we're basically guaranteed err != nil in CodeForError, so we can probably make CodeForError
and the functions it calls to return a code.Code not a pointer to a code.Code. That would clear up some misunderstanding about when things are nil and what the default is, but that isn't necessary for this PR.
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.
An optional suggestion: you could make the parameters, next(id csiErrorBackoffId, err error)
and call CodeForError(err) within next(()
which would allow you to effectively test the defaulting behavior of next()
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 like making CodeForError return a code and not a pointer, I think that would fix your objection?
I think the main thing is if the code is unset then returning Unavailble, which matches the existing backoff error code.
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.
Changing CodeForErrror to return not a pointer helps, but I still have a comment about "I think the main thing is if the code is unset then returning Unavailble, which matches the existing backoff error code."
Change-Id: If514a26bf513fc47de6e74615f352a83268f5ecf
/lgtm |
/cherry-pick release-1.10 |
/cherry-pick release-1.9 |
@mattcary: new pull request created: #1311 In response to this:
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. |
@mattcary: new pull request created: #1312 In response to this:
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. |
/cherry-pick release-1.8 |
@judemars: #1298 failed to apply on top of branch "release-1.8":
In response to this:
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. |
…-upstream-release-1.8 [release-1.8] Automated cherry pick of #1298: Use original error code when backing off
/kind cleanup
This will make it easier to filter errors property for alerting.
-->
/assign @amacaskill