[vtctl|vtctldserver] List/Get Tablets timeouts#7715
[vtctl|vtctldserver] List/Get Tablets timeouts#7715deepthi merged 12 commits intovitessio:masterfrom
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>
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.
tiny typo - you can choose to fix it or not 😁
There was a problem hiding this comment.
😬 let me push up a fix! lol
| GetTablets.Flags().StringVarP(&getTabletsOptions.Keyspace, "keyspace", "k", "", "Keyspace to filter tablets by") | ||
| GetTablets.Flags().StringVarP(&getTabletsOptions.Shard, "shard", "s", "", "Shard to filter tablets by") | ||
| 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.") |
| err error | ||
| ) | ||
|
|
||
| switch { |
There was a problem hiding this comment.
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.
Probably a mix of both haha
| wg.Wait() | ||
|
|
||
| if rec.HasErrors() { | ||
| if req.Strict { |
There was a problem hiding this comment.
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.
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.
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>
doeg
left a comment
There was a problem hiding this comment.
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.GetTabletssimilar to [vtctld] Migrate ShardReplicationPositions #7690 for that method.Strictfield toGetTablets, to dictate whether the rpc should treat partial results from the topo as fatal or not.ListShardTablets/ListAllTabletsto invoke theVtctldServer.GetTabletsmethod 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/vtctlandgo/cmd/vtctldclient/cli.ListTablets, I needed to add aTabletAliasesfield to theGetTabletsRequestproto message, so I chose to make that the highest-precedence filter.topo.PartialResultor not, I updatedtopo.IsErrTypeto useerrors.Asto try to recursivelyUnwrapany wrapped error chain, before falling back to the single-depth type cast check.ListTabletsto useGetTabletsunder 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: