vitess
vitess copied to clipboard
RFC: allow `vtgate` to filter tablets by tag K/Vs
Currently vtgate has support for filtering tablets, but only by keyspace/shard or key-range:
--tablet_filters strings Specifies a comma-separated list of 'keyspace|shard_name or keyrange' values to filter the tablets to watch.
This RFC proposes that vtgate supports filtering by KVs in the Tags map[string]string map of Tablet topodata.Tablet structs. This filtering would work in addition to the mutually-exclusive filters --tablet_filters and --keyspaces_to_watch
This filtering support would allow users more flexibility in routing queries from vtgate, specifically for testing upgrades, performance of new hardware, etc
I envision this support being controlled by a new ~~tablet~~ vtgate flag that allows a list of KVs, such as:
--tablet-filter-tags "mysql_version:8.0,instance_type:i3.xlarge". Users can apply these tag KVs using this existing vttablet flag (that adds the KVs to the Tags map[string]string of topodata.Tablet):
--init_tags StringMap (init parameter) comma separated list of key:value pairs used to tag the tablet
The existing filtering code can support a condition to filter on tablets that match these tags only
Use Case(s)
- A user that would like to direct traffic to specific tablets using arbitrary tablet tags, for example:
- To test upgrading to MySQL 8.x could filter by tag
mysql_version:8.0 - To test upgrading tablets to a newer Vitess release, eg:
vitess_major_version:19 - To test new hardware classes, eg:
instance_type:i3.xlarge
- To test upgrading to MySQL 8.x could filter by tag
I envision this support being controlled by a new tablet flag that allows a list of KVs, such as: --tablet_filter_tags "mysql_version:8.0,instance_type:i3.xlarge".
Don't you mean "a new vtgate flag"?
Don't you mean "a new vtgate flag"?
Whoop, yes updated 👍
I actually did not realize vttablet has tags; we don't really utilize this anywhere yet as far as I can see, but given they exist this is a sensible use case.