-
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
Route INFORMATION_SCHEMA queries #6932
Route INFORMATION_SCHEMA queries #6932
Conversation
Signed-off-by: Andres Taylor <andres@planetscale.com>
Signed-off-by: Andres Taylor <andres@planetscale.com>
Signed-off-by: Andres Taylor <andres@planetscale.com>
Signed-off-by: Andres Taylor <andres@planetscale.com>
…ma and table_name Signed-off-by: Andres Taylor <andres@planetscale.com>
Normally we route queries while planning. For information_schema queries that target routed tables, we need to be able to do the routing in the engine Primitives Signed-off-by: GuptaManan100 <manan@planetscale.com> Signed-off-by: Andres Taylor <andres@planetscale.com>
Signed-off-by: Andres Taylor <andres@planetscale.com>
Signed-off-by: Andres Taylor <andres@planetscale.com>
3c2009e
to
f57954b
Compare
…a_routing_rules Signed-off-by: Andres Taylor <andres@planetscale.com>
Signed-off-by: Andres Taylor <andres@planetscale.com>
When there are predicates for the table_name and table_schema, but the table is not routed, Vitess was failing the query. Signed-off-by: Andres Taylor <andres@planetscale.com>
"vitess.io/vitess/go/vt/vtgate/vindexes" | ||
|
||
"golang.org/x/sync/errgroup" | ||
"vitess.io/vitess/go/vt/sqlparser" |
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 like a formatting issue?
if isTableSchema { | ||
if rut.eroute.SysTableTableSchema != nil { | ||
return vterrors.Errorf(vtrpcpb.Code_INVALID_ARGUMENT, "two predicates for table_schema not supported") | ||
} | ||
rut.eroute.SysTableTableSchema = out | ||
} else { | ||
if rut.eroute.SysTableTableName != nil { | ||
return vterrors.Errorf(vtrpcpb.Code_INVALID_ARGUMENT, "two predicates for table_name not supported") | ||
} | ||
rut.eroute.SysTableTableName = out | ||
} |
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 think the expression can contain apart from table_schema and table_name. We should check the else condition as well.
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.
We do handle other expressions in the WHERE clause. When we are doing pushFilter
on primitiveBuilder
, we look at these expressions to do the routing, but then we still add these expressions to the query:
https://github.com/vitessio/vitess/blob/master/go/vt/vtgate/planbuilder/select.go#L310
Signed-off-by: Andres Taylor <andres@planetscale.com>
Signed-off-by: Andres Taylor <andres@planetscale.com>
For queries against
INFORMATION_SCHEMA.tables
, when the user is asking for a specific table that is routed, Vitess needs to look up where the table is routed, and send the query to a shard in that keyspace.There are two predicates we look for -
TABLE_SCHEMA = ?
andTABLE_NAME = ?
. Vitess uses the values we are searching for to know how to route the query.Fixes #6894