Skip to content

Commit

Permalink
Remove unnecessary setting of keyspace name as performance opt
Browse files Browse the repository at this point in the history
Signed-off-by: Rohit Nayak <rohit@planetscale.com>
  • Loading branch information
rohit-nayak-ps committed Jan 2, 2025
1 parent 4a8724c commit 969b81d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 12 deletions.
1 change: 0 additions & 1 deletion go/test/endtoend/vreplication/global_routing_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,6 @@ func (h *grHelpers) rebuildGraphs(t *testing.T, keyspaces []string) {
require.NoError(t, err)
err = vc.VtctldClient.ExecuteCommand("RebuildVSchemaGraph")
require.NoError(t, err)

}

func TestGlobalRouting(t *testing.T) {
Expand Down
9 changes: 1 addition & 8 deletions go/vt/vtgate/vindexes/vschema.go
Original file line number Diff line number Diff line change
Expand Up @@ -493,14 +493,7 @@ func AddAdditionalGlobalTables(source *vschemapb.SrvVSchema, vschema *VSchema) {
if _, found := vschema.globalTables[tname]; !found {
_, ok := newTables[tname]
if !ok {
ks2 := ksvschema.Keyspace
if ks2 == nil {
ks2 = &Keyspace{Name: ksname}
}
if ks2.Name == "" {
ks2.Name = ksname
}
table.Keyspace = ks2
table.Keyspace = ksvschema.Keyspace
newTables[tname] = &tableInfo{table: table, cnt: 0}
}
newTables[tname].cnt++
Expand Down
7 changes: 4 additions & 3 deletions go/vt/vtgate/vindexes/vschema_routing_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -272,12 +272,13 @@ func TestAutoGlobalRoutingBasic(t *testing.T) {
vschema := BuildVSchema(source, sqlparser.NewTestParser())
require.NotNil(t, vschema)

// Check table is global and points to the correct keyspace
// Check table is global
mustRouteGlobally := func(t *testing.T, tname, ksName string) {
t.Helper()
tbl, err := vschema.FindTable("", tname)
_, err := vschema.FindTable("", tname)
require.NoError(t, err)
require.Equalf(t, ksName, tbl.Keyspace.Name, "table %s should be in keyspace %s", tname, ksName)
// The vtgate data structures don't always set the keyspace name, so cannot reliably check that at the moment.
_ = ksName
}

mustNotRouteGlobally := func(t *testing.T, tname string) {
Expand Down

0 comments on commit 969b81d

Please sign in to comment.