Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cherry pick additional planner fixes (vitessio#1662)
* [vtgate planner] Routing & Merging refactor (vitessio#12197) * start of extracting routing logic out from Route into an interface Signed-off-by: Andres Taylor <[email protected]> * wip - milestone - first plan-test green Signed-off-by: Andres Taylor <[email protected]> * wip - single table routes work fine Signed-off-by: Andres Taylor <[email protected]> * wip - sequence tables passing Signed-off-by: Andres Taylor <[email protected]> * wip - all tests in from_cases.json passing Signed-off-by: Andres Taylor <[email protected]> * wip - more work on merge logic Signed-off-by: Andres Taylor <[email protected]> * wip - need to switch the routes as well Signed-off-by: Andres Taylor <[email protected]> * subquery merging Signed-off-by: Harshit Gangal <[email protected]> * dual routing Signed-off-by: Harshit Gangal <[email protected]> * wip - make sure to keep inner/outer in the right place Signed-off-by: Andres Taylor <[email protected]> * make sure to not forget already seen predicates when merging sharded routes Signed-off-by: Andres Taylor <[email protected]> * add merged subqueries to the merged field Signed-off-by: Andres Taylor <[email protected]> * dual subquery and none routing change Signed-off-by: Harshit Gangal <[email protected]> * handle merging subqueries on IN comparisons Signed-off-by: Andres Taylor <[email protected]> * recalculate routing after merging subquery Signed-off-by: Andres Taylor <[email protected]> * rename field to make it easier to grokk Signed-off-by: Andres Taylor <[email protected]> * better merging logic when merging non-sharded tables Signed-off-by: Andres Taylor <[email protected]> * when merging subqueries, we must also copy predicates Signed-off-by: Andres Taylor <[email protected]> * copy keyspace when producing NoneRouting Signed-off-by: Andres Taylor <[email protected]> * implement Routing methods in TargetedRouting and update OpCode outside of shardedrouting Signed-off-by: Florent Poinsard <[email protected]> * Fix targeted routing update params and rest of the dml cases Signed-off-by: Florent Poinsard <[email protected]> * Enhanced UpdateRoutingLogic function to detect constant null and None routes Signed-off-by: Florent Poinsard <[email protected]> * clean up info schema route mergeing Signed-off-by: Andres Taylor <[email protected]> * handle reference tables with alternates Signed-off-by: Andres Taylor <[email protected]> * update remaining plan_tests Signed-off-by: Andres Taylor <[email protected]> * unify unsharded and reference routing in the same logic Signed-off-by: Andres Taylor <[email protected]> * clean up merging.go Signed-off-by: Andres Taylor <[email protected]> * build the alternate routes with the correct keyspace Signed-off-by: Andres Taylor <[email protected]> * minor fixes after self-review Signed-off-by: Andres Taylor <[email protected]> * when missing current keyspace, any valid keyspace can be used Signed-off-by: Andres Taylor <[email protected]> * final small changes. I promise Signed-off-by: Andres Taylor <[email protected]> * review feedback Signed-off-by: Andres Taylor <[email protected]> * tidy up method after review feedback Signed-off-by: Andres Taylor <[email protected]> * more cleanup - fix goland warnings in new files Signed-off-by: Andres Taylor <[email protected]> * add keyspace information to sequence routing Signed-off-by: Andres Taylor <[email protected]> * more cleanups from PR review Signed-off-by: Andres Taylor <[email protected]> * more cleanup Signed-off-by: Andres Taylor <[email protected]> --------- Signed-off-by: Andres Taylor <[email protected]> Signed-off-by: Harshit Gangal <[email protected]> Signed-off-by: Florent Poinsard <[email protected]> Co-authored-by: Harshit Gangal <[email protected]> Co-authored-by: Florent Poinsard <[email protected]> Signed-off-by: Dirkjan Bussink <[email protected]> * fix dual table handling (vitessio#12204) * fix planner: be careful when merging subqueries We were not checking dependencies of the outer subquery correctly, before merging with a route. This lead to invalid plans being produced. Signed-off-by: Andres Taylor <[email protected]> * fix planner: use tables on lhs when merging subqs When calculating if everything we need is available before merging routes, we now take into account anything coming from the LHS of any joins we are under. Signed-off-by: Andres Taylor <[email protected]> * test: add test merging subquery with join Signed-off-by: Andres Taylor <[email protected]> * use LHS from the top of the current node when planning RHSs Signed-off-by: Florent Poinsard <[email protected]> * added comments Signed-off-by: Andres Taylor <[email protected]> --------- Signed-off-by: Andres Taylor <[email protected]> Signed-off-by: Florent Poinsard <[email protected]> Co-authored-by: Florent Poinsard <[email protected]> Signed-off-by: Dirkjan Bussink <[email protected]> * Update tests to match main Signed-off-by: Dirkjan Bussink <[email protected]> * fix dual table handling (vitessio#12292) * fix dual table handling Signed-off-by: Andres Taylor <[email protected]> * update test expectations Signed-off-by: Andres Taylor <[email protected]> --------- Signed-off-by: Andres Taylor <[email protected]> Signed-off-by: Dirkjan Bussink <[email protected]> * Cleanup duplicate tests Signed-off-by: Dirkjan Bussink <[email protected]> * Fix endtoend tests because of cherry-pick Signed-off-by: Dirkjan Bussink <[email protected]> --------- Signed-off-by: Andres Taylor <[email protected]> Signed-off-by: Harshit Gangal <[email protected]> Signed-off-by: Florent Poinsard <[email protected]> Signed-off-by: Dirkjan Bussink <[email protected]> Co-authored-by: Andres Taylor <[email protected]> Co-authored-by: Harshit Gangal <[email protected]> Co-authored-by: Florent Poinsard <[email protected]>
- Loading branch information