-
Notifications
You must be signed in to change notification settings - Fork 2.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
(re)Formalize SQLError in VReplication, add underlying wrap/unwrap functionality #12327
(re)Formalize SQLError in VReplication, add underlying wrap/unwrap functionality #12327
Conversation
…nctionality Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
Review ChecklistHello reviewers! 👋 Please follow this checklist when reviewing this Pull Request. General
If a new flag is being introduced:
If a workflow is added or modified:
Bug fixes
Non-trivial changes
New/Existing features
Backward compatibility
|
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.
The wrapping parts makes sense to me, but unless I'm missing something we should remove the utils.go
changes.
for wasWrapped { | ||
wasWrapped, err = Unwrap(err) | ||
} |
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 like we should probably add a limit here to prevent never getting out of here some odd reason.
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.
The logic is legit IMHO and the unit tests make good coverage. Please give this another thought. Would you want to see code that counts to 50
and then fails? Would that code look clearer or even more confusing? Please let me know and I'll do whatever you think.
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.
Yeah, what to do when this fails due to hitting the limit would be unknown. We have some protection from infinite recursion and would panic: golang/go@757e0de
So I'm totally fine with it as-is.
The addition to So the idea of this safeguard is very appealing and I think we should keep it. Now, as it happens, the current implementation At any case, if the error has nothing to do with SQL, you get a |
Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
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.
lgtm
@mattlord since you had comments, can you please take another look? |
for wasWrapped { | ||
wasWrapped, err = Unwrap(err) | ||
} |
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.
Yeah, what to do when this fails due to hitting the limit would be unknown. We have some protection from infinite recursion and would panic: golang/go@757e0de
So I'm totally fine with it as-is.
Makes sense (I read through what that code does and how too). Thanks! |
Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
Not sure what changed that a bunch of |
The failing tests are due to the change err = vterrors.UnwrapAll(err) I'm digging in. |
OK i'm reverting the |
Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
I see why the |
Will cherry pick this to v16 manually, since I've merged |
Description
Fixes #12326
This PR re-formalizes SQLError in vreplication in two ways:
vterrors.Wrapf(...)
as opposed tofmt.Errorf(...)
NewSQLErrorFromError()
as suggested by @systay in Bug Report: regression, VReplication errors lost their type, converted to errorString #12326 (comment)While here:
Unwrap
andUnwrapAll
functions invterrors
NewSQLErrorFromError()
to first (attempt to) get the original error object, before resorting to parsing.Added a bunch of unit tests.
Related Issue(s)
Fixes #12326
Precondition for #12323
Precondition for #12325
Formalizes changes made in #10828
Checklist
Deployment Notes