Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
10 changes: 4 additions & 6 deletions go/vt/vtgate/engine/memory_sort_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,14 @@ import (
"context"
"testing"

"vitess.io/vitess/go/vt/servenv"
"vitess.io/vitess/go/vt/vtgate/evalengine"

"vitess.io/vitess/go/mysql/collations"
"vitess.io/vitess/go/test/utils"

"github.com/stretchr/testify/require"

"vitess.io/vitess/go/mysql/collations"
"vitess.io/vitess/go/sqltypes"
"vitess.io/vitess/go/test/utils"
querypb "vitess.io/vitess/go/vt/proto/query"
"vitess.io/vitess/go/vt/servenv"
"vitess.io/vitess/go/vt/vtgate/evalengine"
)

func init() {
Expand Down
1 change: 0 additions & 1 deletion go/vt/vtgate/engine/ordered_aggregate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ import (
"vitess.io/vitess/go/mysql/collations"
"vitess.io/vitess/go/sqltypes"
"vitess.io/vitess/go/test/utils"

binlogdatapb "vitess.io/vitess/go/vt/proto/binlogdata"
querypb "vitess.io/vitess/go/vt/proto/query"
"vitess.io/vitess/go/vt/servenv"
Expand Down
15 changes: 5 additions & 10 deletions go/vt/vtgate/engine/route_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,22 +24,17 @@ import (
"testing"

"github.com/stretchr/testify/assert"

"vitess.io/vitess/go/mysql/sqlerror"
"github.com/stretchr/testify/require"

"vitess.io/vitess/go/mysql/collations"
"vitess.io/vitess/go/mysql/sqlerror"
"vitess.io/vitess/go/sqltypes"
querypb "vitess.io/vitess/go/vt/proto/query"
vtrpcpb "vitess.io/vitess/go/vt/proto/vtrpc"
"vitess.io/vitess/go/vt/servenv"
"vitess.io/vitess/go/vt/vterrors"

"vitess.io/vitess/go/vt/sqlparser"

"vitess.io/vitess/go/vt/vterrors"
"vitess.io/vitess/go/vt/vtgate/evalengine"

"github.com/stretchr/testify/require"

"vitess.io/vitess/go/sqltypes"
querypb "vitess.io/vitess/go/vt/proto/query"
"vitess.io/vitess/go/vt/vtgate/vindexes"
)

Expand Down
10 changes: 8 additions & 2 deletions go/vt/vtgate/planbuilder/plan_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,11 @@ func TestPlan(t *testing.T) {

func TestSystemTables57(t *testing.T) {
// first we move everything to use 5.7 logic
oldVer := servenv.MySQLServerVersion()
servenv.SetMySQLServerVersionForTest("5.7")
defer servenv.SetMySQLServerVersionForTest("")
defer func() {
servenv.SetMySQLServerVersionForTest(oldVer)
}()
vschemaWrapper := &vschemaWrapper{v: loadSchema(t, "vschemas/schema.json", true)}
testOutputTempDir := makeTestOutput(t)
testFile(t, "info_schema57_cases.json", testOutputTempDir, vschemaWrapper, false)
Expand Down Expand Up @@ -193,8 +196,11 @@ func TestOneWithTPCHVSchema(t *testing.T) {

func TestOneWith57Version(t *testing.T) {
// first we move everything to use 5.7 logic
oldVer := servenv.MySQLServerVersion()
servenv.SetMySQLServerVersionForTest("5.7")
defer servenv.SetMySQLServerVersionForTest("")
defer func() {
servenv.SetMySQLServerVersionForTest(oldVer)
}()
vschema := &vschemaWrapper{v: loadSchema(t, "vschemas/schema.json", true)}

testFile(t, "onecase.json", "", vschema, false)
Expand Down
16 changes: 11 additions & 5 deletions go/vt/vtgate/semantics/info_schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -1671,16 +1671,22 @@ type infoSchemaWithColumns struct {
infoSchemaData map[string][]vindexes.Column
}

// We cache this information, since these are maps that are not changed
var infoSchema57 = getInfoSchema57()
var infoSchema80 = getInfoSchema80()

// newSchemaInfo returns a SchemaInformation that has the column information for all info_schema tables
func newSchemaInfo(inner SchemaInformation) SchemaInformation {
return &infoSchemaWithColumns{inner: inner, infoSchemaData: loadSchemaInfo()}
}

func loadSchemaInfo() map[string][]vindexes.Column {
version := servenv.MySQLServerVersion()
var infoSchema map[string][]vindexes.Column
if strings.HasPrefix(version, "5.7") {
infoSchema = getInfoSchema57()
} else {
infoSchema = getInfoSchema80()
return infoSchema57
}
return &infoSchemaWithColumns{inner: inner, infoSchemaData: infoSchema}

return infoSchema80
}

// FindTableOrVindex implements the SchemaInformation interface
Expand Down