-
Notifications
You must be signed in to change notification settings - Fork 2k
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: reserved connection retry logic when vttablet or mysql is down #10005
Conversation
go/vt/vtgate/scatter_conn.go
Outdated
if err != nil { | ||
return nil, err | ||
} | ||
qs = rs.Gateway |
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.
Is the idea here that we route it through the gateway again and it will pick a tablet for us?
That's clever 💯
Signed-off-by: Harshit Gangal <harshit@planetscale.com>
…ablet is down then it should go through gateway Signed-off-by: Harshit Gangal <harshit@planetscale.com>
… if needed and not executeLock Signed-off-by: Harshit Gangal <harshit@planetscale.com>
Signed-off-by: Harshit Gangal <harshit@planetscale.com>
… healthy tablet for the given tablet_type Signed-off-by: Harshit Gangal <harshit@planetscale.com>
37eac82
to
2b89ecd
Compare
} | ||
|
||
func requireNewQS(err error, target *querypb.Target) bool { | ||
code := vterrors.Code(err) | ||
msg := err.Error() | ||
return (code == vtrpcpb.Code_FAILED_PRECONDITION && vterrors.RxWrongTablet.MatchString(msg)) || | ||
(code == vtrpcpb.Code_CLUSTER_EVENT && ((target != nil && target.TabletType == topodatapb.TabletType_PRIMARY) || vterrors.RxOp.MatchString(msg))) | ||
if (code == vtrpcpb.Code_FAILED_PRECONDITION && vterrors.RxWrongTablet.MatchString(msg)) || |
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.
nit: maybe this could benefit from the same treatment as ☝️
…itessio#10005) * fix: when mysql is down and vttablet is up Signed-off-by: Harshit Gangal <harshit@planetscale.com> * fix: in reserved conn with no transaction if the queryservice i.e vttablet is down then it should go through gateway Signed-off-by: Harshit Gangal <harshit@planetscale.com> * refactor: execute and streamExecute should be able to reset the shard if needed and not executeLock Signed-off-by: Harshit Gangal <harshit@planetscale.com> * test: e2e test for bug fix Signed-off-by: Harshit Gangal <harshit@planetscale.com> * fix: when mysql is down, query should go through gateway to elect new healthy tablet for the given tablet_type Signed-off-by: Harshit Gangal <harshit@planetscale.com>
…10005) (#10052) * fix: when mysql is down and vttablet is up Signed-off-by: Harshit Gangal <harshit@planetscale.com> * fix: in reserved conn with no transaction if the queryservice i.e vttablet is down then it should go through gateway Signed-off-by: Harshit Gangal <harshit@planetscale.com> * refactor: execute and streamExecute should be able to reset the shard if needed and not executeLock Signed-off-by: Harshit Gangal <harshit@planetscale.com> * test: e2e test for bug fix Signed-off-by: Harshit Gangal <harshit@planetscale.com> * fix: when mysql is down, query should go through gateway to elect new healthy tablet for the given tablet_type Signed-off-by: Harshit Gangal <harshit@planetscale.com>
Description
This PR fixes issues with reserved connection when the vttablet or the underlying MySQL process is down.
The VTGate needs to understand the error codes/messages to redirect it to the new available tablet.
In all the above scenarios the current reserved connection held should be dropped and a new one should be created by calling the ReserveExecute API to the tablet.
Related Issue(s)
Checklist
Deployment Notes