vitessio / vitess

Vitess is a database clustering system for horizontal scaling of MySQL.
http://vitess.io
Apache License 2.0
18.47k stars 2.09k forks source link

Feature Request: Global routing doesn't work with tables not in vschema despite schema tracking #16516

Closed GuptaManan100 closed 1 month ago

GuptaManan100 commented 1 month ago

Feature Description

If there are some tables that aren't specified in the vschema (This can be the case especially for unsharded keyspaces), then global routing doesn't work for them despite schema tracking running.

It would be nice if we could get the following scenario to work -

  1. A user sets up 2 keyspaces, one of which is unsharded.
  2. They create a table in the unsharded keyspace but don't add it to the Vschema.
  3. If schema tracking is running, if the table created has a globally unique name, then we should support global routing on it.

Use Case(s)

Described ☝️

GuptaManan100 commented 1 month ago

Global routing rules originally wasn't meant to work for tables that aren't part of the vschema. We tried addressing this limitation in #16517, but we ran into an issue with MoveTables as described in https://github.com/vitessio/vitess/pull/16517#issuecomment-2275416209.

There is no easy way to resolve this issue, so we after internal discussion we concluded that we won't be able to support this feature request. For global routing to work for tables created in an unsharded keyspace, they should be added to the vschema. To do this, the vschema can be updated and applied by the vtctld, or a DDL statement like ALTER VSCHEMA ADD TABLE keyspace_name.table_name can be run from the vtgate.