Skip to content

Commit

Permalink
Decouple topotools from vschema (#16008)
Browse files Browse the repository at this point in the history
Signed-off-by: Dirkjan Bussink <[email protected]>
  • Loading branch information
dbussink authored May 25, 2024
1 parent 248014e commit d95ce48
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions go/vt/vtgate/vindexes/vschema.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import (
"time"

"vitess.io/vitess/go/ptr"
"vitess.io/vitess/go/vt/topotools"

"vitess.io/vitess/go/json2"
"vitess.io/vitess/go/mysql/collations"
Expand Down Expand Up @@ -1015,10 +1014,14 @@ func buildShardRoutingRule(source *vschemapb.SrvVSchema, vschema *VSchema) {

func buildKeyspaceRoutingRule(source *vschemapb.SrvVSchema, vschema *VSchema) {
vschema.KeyspaceRoutingRules = nil
if len(source.GetKeyspaceRoutingRules().GetRules()) == 0 {
sourceRules := source.GetKeyspaceRoutingRules().GetRules()
if len(sourceRules) == 0 {
return
}
rulesMap := topotools.GetKeyspaceRoutingRulesMap(source.KeyspaceRoutingRules)
rulesMap := make(map[string]string, len(sourceRules))
for _, rr := range sourceRules {
rulesMap[rr.FromKeyspace] = rr.ToKeyspace
}
vschema.KeyspaceRoutingRules = rulesMap
}

Expand Down

0 comments on commit d95ce48

Please sign in to comment.