Skip to content
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 explain tab plan to the proper Keyspace #10027

Merged
merged 2 commits into from
Apr 4, 2022

Conversation

frouioui
Copy link
Member

@frouioui frouioui commented Apr 4, 2022

Description

This pull request introduces FindKeyspace to the VSchema interface, allowing us to route explain queries to the proper keyspace regardless if the target is a MySQL table or a Vindex table.

Based on the issue reported in #10019, running a query that describes a Vindex led to a panic in VTGate. When running the local example to have a sharded cluster, the queries that follow used to crash:

mysql> use customer;
mysql> desc hash;
ERROR 2013 (HY000): Lost connection to MySQL server during query
No connection. Trying to reconnect...
Connection id:    8
Current database: customer

ERROR 2013 (HY000): Lost connection to MySQL server during query
No connection. Trying to reconnect...
Connection id:    9
Current database: customer

ERROR 2013 (HY000): Lost connection to MySQL server during query
mysql> 

With the patch proposed in this pull request, the same queries produce the output that follows.

mysql> use customer;
mysql> desc hash;
ERROR 1146 (42S02): target: customer.80-.primary: vttablet: rpc error: code = NotFound desc = Table 'vt_customer.hash' doesn't exist (errno 1146) (sqlstate 42S02) (CallerID: userData1): Sql: "explain `hash`", BindVars: {}

The MySQL error is expected as there is no hash table in this keyspace. Describe/explain are used to obtain information about table structure or query execution plans, not indexes.

Related Issue(s)

Checklist

  • Should this PR be backported?
  • Tests were added or are not required
  • Documentation was added or is not required

…FindKeyspace

Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr>
Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr>
@frouioui frouioui merged commit 6882ee1 into vitessio:main Apr 4, 2022
@frouioui frouioui deleted the fix-10019 branch April 4, 2022 16:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug Report: planbuilder vtgate panic on DESC of hash vindex
2 participants