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

[vtgate planner] Routing & Merging refactor #12197

Merged
merged 37 commits into from
Feb 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
f9561fa
start of extracting routing logic out from Route into an interface
systay Jan 27, 2023
f03b14c
wip - milestone - first plan-test green
systay Jan 31, 2023
b05601a
wip - single table routes work fine
systay Jan 31, 2023
383fa5c
wip - sequence tables passing
systay Jan 31, 2023
85fc461
wip - all tests in from_cases.json passing
systay Feb 1, 2023
dceb990
wip - more work on merge logic
systay Feb 3, 2023
1c88334
wip - need to switch the routes as well
systay Feb 9, 2023
dfdb741
subquery merging
harshit-gangal Feb 9, 2023
671a684
dual routing
harshit-gangal Feb 9, 2023
5917321
wip - make sure to keep inner/outer in the right place
systay Feb 9, 2023
a915603
make sure to not forget already seen predicates when merging sharded …
systay Feb 9, 2023
42593dd
add merged subqueries to the merged field
systay Feb 10, 2023
7526a00
dual subquery and none routing change
harshit-gangal Feb 10, 2023
a635fe8
handle merging subqueries on IN comparisons
systay Feb 10, 2023
138994f
recalculate routing after merging subquery
systay Feb 13, 2023
0572046
rename field to make it easier to grokk
systay Feb 13, 2023
24ec13c
better merging logic when merging non-sharded tables
systay Feb 13, 2023
b1179e5
when merging subqueries, we must also copy predicates
systay Feb 13, 2023
b148822
copy keyspace when producing NoneRouting
systay Feb 13, 2023
6934749
implement Routing methods in TargetedRouting and update OpCode outsid…
frouioui Feb 13, 2023
1ee4558
Fix targeted routing update params and rest of the dml cases
frouioui Feb 13, 2023
a4bac20
Enhanced UpdateRoutingLogic function to detect constant null and None…
frouioui Feb 13, 2023
60e651e
clean up info schema route mergeing
systay Feb 13, 2023
a964b0b
handle reference tables with alternates
systay Feb 13, 2023
8c59b70
update remaining plan_tests
systay Feb 13, 2023
7001f97
unify unsharded and reference routing in the same logic
systay Feb 13, 2023
c982062
clean up merging.go
systay Feb 13, 2023
52b98a4
build the alternate routes with the correct keyspace
systay Feb 14, 2023
c877106
minor fixes after self-review
systay Feb 14, 2023
04fd6f5
when missing current keyspace, any valid keyspace can be used
systay Feb 14, 2023
1cb7df0
final small changes. I promise
systay Feb 14, 2023
c764429
review feedback
systay Feb 14, 2023
ff8a713
tidy up method after review feedback
systay Feb 14, 2023
1352119
more cleanup - fix goland warnings in new files
systay Feb 14, 2023
7245a70
add keyspace information to sequence routing
systay Feb 15, 2023
19e024b
more cleanups from PR review
systay Feb 15, 2023
87e3812
more cleanup
systay Feb 15, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion go/test/dbg/dbg.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
"go/format"
"go/parser"
"go/token"
"io"
"os"
"path"
"runtime"
Expand Down Expand Up @@ -163,6 +164,17 @@ func V[Val any](v Val) Val {

// P prints all the arguments passed to the function in verbose debug form
func P(vals ...any) {
dump(vals, os.Stdout)
}

// S returns a string with all the arguments passed to the function in verbose debug form
func S(vals ...any) string {
buf := &strings.Builder{}
dump(vals, buf)
return buf.String()
}

func dump(vals []any, writer io.Writer) {
var p *params
if _, f, lineno, ok := runtime.Caller(1); ok {
p = defaultCache.resolve(f, lineno)
Expand All @@ -176,5 +188,7 @@ func P(vals ...any) {
w := text.NewIndentWriter(&buf, nil, bytes.Repeat([]byte{' '}, indent))
fmt.Fprintf(w, "%# v\n", pretty.Formatter(v))
}
_, _ = buf.WriteTo(os.Stdout)

_, _ = buf.WriteTo(writer)

}
10 changes: 5 additions & 5 deletions go/vt/sqlparser/ast.go
Original file line number Diff line number Diff line change
Expand Up @@ -2470,11 +2470,11 @@ type (
// This is a struct that the parser will never produce - it's written and read by the gen4 planner
// CAUTION: you should only change argName and hasValuesArg through the setter methods
ExtractedSubquery struct {
Original Expr // original expression that was replaced by this ExtractedSubquery
OpCode int // this should really be engine.PulloutOpCode, but we cannot depend on engine :(
Subquery *Subquery
OtherSide Expr // represents the side of the comparison, this field will be nil if Original is not a comparison
NeedsRewrite bool // tells whether we need to rewrite this subquery to Original or not
Original Expr // original expression that was replaced by this ExtractedSubquery
OpCode int // this should really be engine.PulloutOpCode, but we cannot depend on engine :(
Subquery *Subquery
OtherSide Expr // represents the side of the comparison, this field will be nil if Original is not a comparison
Merged bool // tells whether we need to rewrite this subquery to Original or not

hasValuesArg string
argName string
Expand Down
2 changes: 1 addition & 1 deletion go/vt/sqlparser/ast_equals.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading