From d95ce484e01781fb79c1962c3dc8499692c20e90 Mon Sep 17 00:00:00 2001 From: Dirkjan Bussink Date: Sat, 25 May 2024 13:34:55 +0200 Subject: [PATCH] Decouple topotools from vschema (#16008) Signed-off-by: Dirkjan Bussink --- go/vt/vtgate/vindexes/vschema.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/go/vt/vtgate/vindexes/vschema.go b/go/vt/vtgate/vindexes/vschema.go index 12ed56d3ddc..020b07f7073 100644 --- a/go/vt/vtgate/vindexes/vschema.go +++ b/go/vt/vtgate/vindexes/vschema.go @@ -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" @@ -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 }