-
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
[vtctl|vtctldserver] List/Get Tablets timeouts #7715
Conversation
Signed-off-by: Andrew Mason <amason@slack-corp.com>
…l data Signed-off-by: Andrew Mason <amason@slack-corp.com>
Signed-off-by: Andrew Mason <amason@slack-corp.com>
…erver Signed-off-by: Andrew Mason <amason@slack-corp.com>
Signed-off-by: Andrew Mason <amason@slack-corp.com>
Signed-off-by: Andrew Mason <amason@slack-corp.com>
Signed-off-by: Andrew Mason <amason@slack-corp.com>
Signed-off-by: Andrew Mason <amason@slack-corp.com>
Signed-off-by: Andrew Mason <amason@slack-corp.com>
Signed-off-by: Andrew Mason <amason@slack-corp.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
proto/vtctldata.proto
Outdated
bool strict = 4; | ||
// TabletAliases is an optional list of tablet aliases to fetch Tablet objects | ||
// for. If specified, Keyspace, Shard, and Cells are ignored, and tablets are | ||
// looked up by their respective aliase's Cells directly. |
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.
tiny typo - you can choose to fix it or not 😁
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.
😬 let me push up a fix! lol
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.
Looks good to meeee
GetTablets.Flags().StringVar(&getTabletsOptions.Format, "format", "awk", "Output format to use; valid choices are (json, awk)") | ||
GetTablets.Flags().BoolVar(&getTabletsOptions.Strict, "strict", false, "Require all cells to return successful tablet data. Without --strict, tablet listings may be partial.") |
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.
chef kiss
err error | ||
) | ||
|
||
switch { |
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.
Not sure to what extent this is a golang thing or a you thing, but I really like this (and other) uses of switch
(instead of if/else, presumably). Going to osmose this pattern into our TypeScript more often. >:)
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.
Probably a mix of both haha
wg.Wait() | ||
|
||
if rec.HasErrors() { | ||
if req.Strict { |
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.
Super minor point that you are welcome to ignore -- my $0.02 is that if req.Strict || len(rec.Errors) == len(cells)
is slightly more readable (or at least, what I'd expect, since it took me a sec to realize the two ifs are doing the same thing).
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.
Not exactly :) (I ran into this issue when a test broke)
If len(cells) == 0
, then len(rec.Errors) == len(cells)
but rec.HasErrors() == false
, which is why we have to be a little more verbose/redundant here
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 misunderstood! I thought you were suggesting to replace the outer if rec.HasErrors()
with the composite boolean, not to replace the two branches. You're totally right, and it's way easier to understand. Pushing up a fix! 😊
Signed-off-by: Andrew Mason <amason@slack-corp.com>
Signed-off-by: Andrew Mason <amason@slack-corp.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.
30min of rerunning flaky tests and everything finally passes. Haha. Here's an extra approval for good measure.
cilcky clicky on the retry button! thanks ❤️ |
[vtctl|vtctldserver] List/Get Tablets timeouts Signed-off-by: Rafael Chacon <rafael@slack-corp.com>
Description
This PR tackles several things at once (sorry!)
VtctldServer.GetTablets
similar to [vtctld] Migrate ShardReplicationPositions #7690 for that method.Strict
field toGetTablets
, to dictate whether the rpc should treat partial results from the topo as fatal or not.ListShardTablets
/ListAllTablets
to invoke theVtctldServer.GetTablets
method under the hood, so that they get the timeout fix for free. This also let me delete some helper methods that were duplicated betweengo/vt/vtctl
andgo/cmd/vtctldclient/cli
.ListTablets
, I needed to add aTabletAliases
field to theGetTabletsRequest
proto message, so I chose to make that the highest-precedence filter.topo.PartialResult
or not, I updatedtopo.IsErrType
to useerrors.As
to try to recursivelyUnwrap
any wrapped error chain, before falling back to the single-depth type cast check.ListTablets
to useGetTablets
under the hood, and delete the rest of the duplicated cli formatting helper code that was now dead.Examples!
vtctldclient
- healthy => bad topo => strictlegacy
vtctlclient
, pre-fixlegacy
vtctlclient
, post-fixvtctldclient
, with new tablet alias filteringRelated Issue(s)
Checklist
Deployment Notes
Impacted Areas in Vitess
Components that this PR will affect: