Add keyspace, shard, and tablet-type/alias filters to ListTablets#317
Merged
Conversation
ListTablets sent no query parameters, so callers had to fetch every tablet on a branch. The branch tablets API now accepts filters that map to vtctldclient GetTablets, so expose them on ListBranchTabletsRequest: - Keyspace, Shard, and TabletType are sent as query parameters. - TabletAliases is sent as a single comma-separated tablet_alias param. Only non-empty filters are sent, so an unfiltered request is unchanged.
no-itsbackpack
approved these changes
Jun 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Vtctld.ListTabletssent no query parameters, so callers (notablypscale branch list-tablets) had to fetch every tablet on a branch and filter client-side. On large, multi-keyspace branches that makes finding a specific tablet alias painfulChanges
ListBranchTabletsRequestgains four optional filter fields:Keyspace,Shard,TabletType— sent askeyspace/shard/tablet_typequery parameters.TabletAliases []string— sent as a single comma-separatedtablet_aliasquery parameter (matching the api-bb contract). When set, the server ignores the other filters.Only non-empty filters are added to the query string, so an unfiltered
ListTabletscall behaves exactly as before. The implementation uses the sameWithQueryParamspattern as the otherVtctldmethods (ListWorkflows,ListKeyspaces).Testing
Added
vtctld_tablets_test.go(there was no test file before):TabletAliasesare serialized into one comma-separatedtablet_aliasvalue.go build,go vet,gofmt, and the full./planetscale/test suite pass locally.