forked from vitessio/vitess
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
query routing: multi-table plan options
In this change the query routing takes the possibility that there could be multiple target options for a given table. The design for this is explained in vitessio#4790. At a high level: * VSchema.FindTableOrVindex function can return a list of tables instead of a single one. * The route planbuilder creates multiple routeOptions, one for each table returned. * All actions that affected the plan of a route are changed to update all routeOptions. * If a particular routeOption cannot accommodate a pushed down construct, it's removed from the list. Previously, this was an error case. But if no options are left, then we return an error. * If two routeOptions qualify for a merge of routes, then all other combinations that don't qualify are discarded. This is the case for joins, subqueries and unions. More details: vindexTable was renamed to the more appropriate vschemaTable. In order to achieve this, a new routeOption data type was introduced, and route was changed to contain a list of routeOptions. In symtab, tables used to point at the vschema table that was used to build them. Since a table can now represent multiple target tables, this field has been moved into routeOption. In symtab, columns used to contain a vindex member. Since this can change depending on the target table, the routeOption now contains a map of column to vindexes instead. The routeOption also contains the vschemaTable. DMLs use this information. Since DMLs have to be more deterministic about the table they write to, they always choose the first option. At the beginning of the Wireup phase, we evaluate all existing options and decide on the best available. To be done: When a table has multiple targets, the targets can have different names than the original table. If so, the queries have to be rewritten to address the new target tables. In order to do this, each routeOption will contain a list of substitutions that will be made during the Wireup phase. Tests have to be written for the new flows. Signed-off-by: Sugu Sougoumarane <ssougou@gmail.com>
- Loading branch information
Showing
25 changed files
with
821 additions
and
628 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.