Skip to content
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

Change Error Messages In VTGate #7514

Merged
merged 27 commits into from
Mar 2, 2021

Conversation

harshit-gangal
Copy link
Member

@harshit-gangal harshit-gangal commented Feb 18, 2021

Signed-off-by: Harshit Gangal harshit@planetscale.com

Description

Related Issue(s)

#7533

Checklist

  • Tests were added or are not required
  • Documentation was added or is not required

Deployment Notes

Impacted Areas in Vitess

Components that this PR will affect:

  • Query Serving

Signed-off-by: Harshit Gangal <harshit@planetscale.com>
Signed-off-by: Harshit Gangal <harshit@planetscale.com>
Signed-off-by: Harshit Gangal <harshit@planetscale.com>
Signed-off-by: Harshit Gangal <harshit@planetscale.com>
Signed-off-by: Harshit Gangal <harshit@planetscale.com>
Signed-off-by: Harshit Gangal <harshit@planetscale.com>
Signed-off-by: Harshit Gangal <harshit@planetscale.com>
Signed-off-by: Harshit Gangal <harshit@planetscale.com>
Signed-off-by: Harshit Gangal <harshit@planetscale.com>
Signed-off-by: Harshit Gangal <harshit@planetscale.com>
Signed-off-by: Harshit Gangal <harshit@planetscale.com>
Signed-off-by: Harshit Gangal <harshit@planetscale.com>
Signed-off-by: Harshit Gangal <harshit@planetscale.com>
Signed-off-by: Harshit Gangal <harshit@planetscale.com>
…o vterrors state

Signed-off-by: Harshit Gangal <harshit@planetscale.com>
…enerate vterrors errors that will be converted later to mysql errors

Signed-off-by: Harshit Gangal <harshit@planetscale.com>
Signed-off-by: Harshit Gangal <harshit@planetscale.com>
…executor in vtgate

Signed-off-by: Harshit Gangal <harshit@planetscale.com>
Signed-off-by: Harshit Gangal <harshit@planetscale.com>
Signed-off-by: Harshit Gangal <harshit@planetscale.com>
Signed-off-by: Harshit Gangal <harshit@planetscale.com>
Signed-off-by: Harshit Gangal <harshit@planetscale.com>
@harshit-gangal harshit-gangal marked this pull request as ready for review February 26, 2021 20:18
…rrors

Signed-off-by: Harshit Gangal <harshit@planetscale.com>
@@ -162,6 +149,56 @@ func NewSQLErrorFromError(err error) error {
return serr
}

var stateToMysqlCode = map[vterrors.State]struct {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@@ -185,6 +188,24 @@ func Code(err error) vtrpcpb.Code {
return vtrpcpb.Code_UNKNOWN
}

// ErrState returns the error state if it's a vtError.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

}
for i, field2 := range fields2 {
field1 := fields1[i]
if field1.Type != field2.Type {
return vterrors.Errorf(vtrpcpb.Code_INVALID_ARGUMENT, "column field type does not match for name: (%v, %v) types: (%v, %v)", field1.Name, field2.Name, field1.Type, field2.Type)
return vterrors.Errorf(vtrpcpb.Code_UNIMPLEMENTED, "merging field of different types is not supported, name: (%v, %v) types: (%v, %v)", field1.Name, field2.Name, field1.Type, field2.Type)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Signed-off-by: Harshit Gangal <harshit@planetscale.com>
if !allowed {
return vterrors.Errorf(vtrpcpb.Code_PERMISSION_DENIED, "not authorized to perform vschema operations")

return vterrors.NewErrorf(vtrpcpb.Code_PERMISSION_DENIED, vterrors.AccessDeniedError, "User '%s' to perform vschema operations", user.GetUsername())
Copy link
Collaborator

@systay systay Mar 1, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this message looks a bit weird to me.
shouldn't it say: User '%s' is not authorized to perform vschema operations

Signed-off-by: Andres Taylor <andres@planetscale.com>
Signed-off-by: Andres Taylor <andres@planetscale.com>
Signed-off-by: Andres Taylor <andres@planetscale.com>
Copy link
Collaborator

@systay systay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really nice work. 👏
I was thinking we'd let @deepthi look at the changes in 2ab202b to make sure they look ok.

@systay systay requested a review from deepthi March 1, 2021 11:36
@deepthi
Copy link
Member

deepthi commented Mar 1, 2021

Really nice work.
I was thinking we'd let @deepthi look at the changes in 2ab202b to make sure they look ok.

I think the change means it may get harder to debug/diagnose certain failures. How about logging err when it is not-nil? Do you think that might be useful?

@harshit-gangal
Copy link
Member Author

Really nice work.
I was thinking we'd let @deepthi look at the changes in 2ab202b to make sure they look ok.

I think the change means it may get harder to debug/diagnose certain failures. How about logging err when it is not-nil? Do you think that might be useful?

The error is always send back to client. If the target is not nil then it is added to the error message.
The change is that we removed the tablet url to be added to the error message.

I will go ahead and merge the PR. If there is any concern we can fix forward.

@harshit-gangal harshit-gangal merged commit 451279d into vitessio:master Mar 2, 2021
@harshit-gangal harshit-gangal deleted the fix-vtgate-errors branch March 2, 2021 05:56
@askdba askdba added this to the v10.0 milestone Mar 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants