tabletmanager/grpctmclient: use vtrpcpb/gRPC error codes#18565
tabletmanager/grpctmclient: use vtrpcpb/gRPC error codes#18565timvaillancourt merged 5 commits intovitessio:mainfrom
tabletmanager/grpctmclient: use vtrpcpb/gRPC error codes#18565Conversation
Review ChecklistHello reviewers! 👋 Please follow this checklist when reviewing this Pull Request. General
Tests
Documentation
New flags
If a workflow is added or modified:
Backward compatibility
|
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #18565 +/- ##
=======================================
Coverage 67.51% 67.51%
=======================================
Files 1607 1607
Lines 263548 263567 +19
=======================================
+ Hits 177941 177958 +17
- Misses 85607 85609 +2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
9bd2d98 to
d6bdc34
Compare
There was a problem hiding this comment.
It turns out vterrors.ToGRPC is required for mapping Vitess errors -> gPRC codes. The other RPC servers are calling this, but not tabletmanager before this PR
There was a problem hiding this comment.
Flattening (de-wrapping) this error should be fine, because nothing else is interested in the error chain before it becomes a gRPC-style error in the following lines
|
cc @arthurschreiber as this is something we discussed at an offsite (onsite?), also in #18528 |
tabletmanager: map sqlerrors to vtrpcpb codestabletmanager: map sqlerrors to vtrpcpb/gRPC error codes
|
@timvaillancourt please notice a couple commits are unsigned, we will have to force-push |
Signed-off-by: Tim Vaillancourt <tim@timvaillancourt.com>
fc7e6c9 to
0ab45e0
Compare
Signed-off-by: Tim Vaillancourt <tim@timvaillancourt.com>
Signed-off-by: Tim Vaillancourt <tim@timvaillancourt.com>
Signed-off-by: Tim Vaillancourt <tim@timvaillancourt.com>
Signed-off-by: Tim Vaillancourt <tim@timvaillancourt.com>
@shlomi-noach thanks again! I squashed my commits with a proper signing now, so DCO is resolved ✅ Also, I had to modify some throttler client code slightly to make tests pass, after baking |
tabletmanager: map sqlerrors to vtrpcpb/gRPC error codestabletmanager/grpctmclient: use vtrpcpb/gRPC error codes
|
@shlomi-noach oh wow, the GitHub auto-merge feature did not consider that I re-requested your review Looks like it merged this with 1/2 reviews (Harshit = 👍, you = re-requested), technically 👎 Please let me know if you see any problems with what was merged and I'll follow up with a PR quickly 🙇 |
|
@timvaillancourt that's fine. GitHub-wise, the way to do it correctly is to "dismiss" my review before re-requesting it. Re: TODO for v24, would you please create an Issue and assign yourself, so that we have this tracked? |
Thanks!
Sounds good, created that here: #18663 👍 |
Description
This PR causes
tabletmanagerRPCs to return real gRPC/vterrorserror codes, to address theUnknownerror codetabletmanagerRPCs currently return for problems executing an RPC. Now tablets with downed-mysqldwill return the gRPCUnavailablecode with the error message unchanged, for exampleTo achieve this, the existing
switchstatement intabletserver'sconvertErrorCode(err error) errorfunc was moved to be a method of*sqlerror.SQLError:VtRpcErrorCode() vtrpcpb.Code. I did not name this.ErrorCode()because this would be confusing, assqlerrors.ErrorCodeis a type that is used for something else entirelyThis has been tested in non-prod environment at Slack and things look good 👍
Before w/
mysqldkilled +StopReplicationAndGetStatusRPC (code = Unknown👎)rpc error: code = Unknown desc = TabletManager.StopReplicationAndGetStatus on REDACTED-TABLETALIAS: before status failed: net.Dial(/mnt/vitess/mysql/datadir/mysql.sock) to local server failed: dial unix /mnt/vitess/mysql/datadir/mysql.sock: connect: connection refused (errno 2002) (sqlstate HY000)After w/
mysqldkilled +StopReplicationAndGetStatusRPC (code = Unavailable👍)rpc error: code = Unavailable desc = TabletManager.StopReplicationAndGetStatus on REDACTED-TABLETALIAS: before status failed: net.Dial(/mnt/vitess/mysql/datadir/mysql.sock) to local server failed: dial unix /mnt/vitess/mysql/datadir/mysql.sock: connect: connection refused (errno 2002) (sqlstate HY000)and VTOrc (
FullStatusRPC based) sees: (code = Unavailable👍)🎉
Related Issue(s)
Partially addresses: #18528
Checklist
Deployment Notes