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

Update to latest Vitess #17

Closed
wants to merge 1 commit into from
Closed
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
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ require (
github.com/spf13/pflag v1.0.5
github.com/stretchr/testify v1.8.4
golang.org/x/sync v0.6.0
vitess.io/vitess v0.10.3-0.20240115103031-ca4246d93812
vitess.io/vitess v0.10.3-0.20240121130840-6c4c5faa7029
)

require (
Expand All @@ -20,7 +20,7 @@ require (
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/yudai/golcs v0.0.0-20170316035057-ecda9a501e82 // indirect
golang.org/x/sys v0.16.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240102182953-50ed04b92917 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240108191215-35c7eff3a6b1 // indirect
google.golang.org/grpc v1.60.1 // indirect
google.golang.org/protobuf v1.32.0 // indirect
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
Expand Down
12 changes: 6 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,17 @@ github.com/yudai/golcs v0.0.0-20170316035057-ecda9a501e82 h1:BHyfKlQyqbsFN5p3Ifn
github.com/yudai/golcs v0.0.0-20170316035057-ecda9a501e82/go.mod h1:lgjkn3NuSvDfVJdfcVVdX+jpBxNmX4rDAzaS45IcYoM=
go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto=
go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE=
golang.org/x/net v0.19.0 h1:zTwKpTd2XuCqf8huc7Fo2iSy+4RHPd10s4KzeTnVr1c=
golang.org/x/net v0.19.0/go.mod h1:CfAk/cbD4CthTvqiEl8NpboMuiuOYsAr/7NOjZJtv1U=
golang.org/x/net v0.20.0 h1:aCL9BSgETF1k+blQaYUBx9hJ9LOGP3gAVemcZlf1Kpo=
golang.org/x/net v0.20.0/go.mod h1:z8BVo6PvndSri0LbOE3hAn0apkU+1YvI6E70E9jsnvY=
golang.org/x/sync v0.6.0 h1:5BMeUDZ7vkXGfEr1x9B4bRcTH4lpkTkpdh0T/J+qjbQ=
golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU=
golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/genproto/googleapis/rpc v0.0.0-20240102182953-50ed04b92917 h1:6G8oQ016D88m1xAKljMlBOOGWDZkes4kMhgGFlf8WcQ=
google.golang.org/genproto/googleapis/rpc v0.0.0-20240102182953-50ed04b92917/go.mod h1:xtjpI3tXFPP051KaWnhvxkiubL/6dJ18vLVf7q2pTOU=
google.golang.org/genproto/googleapis/rpc v0.0.0-20240108191215-35c7eff3a6b1 h1:gphdwh0npgs8elJ4T6J+DQJHPVF7RsuJHCfwztUb4J4=
google.golang.org/genproto/googleapis/rpc v0.0.0-20240108191215-35c7eff3a6b1/go.mod h1:daQN87bsDqDoe316QbbvX60nMoJQa4r6Ds0ZuoAe5yA=
google.golang.org/grpc v1.60.1 h1:26+wFr+cNqSGFcOXcabYC0lUVJVRa2Sb2ortSK7VrEU=
google.golang.org/grpc v1.60.1/go.mod h1:OlCHIeLYqSSsLi6i49B5QGdzaMZK9+M7LXN2FKz4eGM=
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
Expand All @@ -67,5 +67,5 @@ gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gotest.tools v2.2.0+incompatible h1:VsBPFP1AI068pPrMxtb/S8Zkgf9xEmTLJjfM+P5UIEo=
gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw=
vitess.io/vitess v0.10.3-0.20240115103031-ca4246d93812 h1:Ade8v/dpl/X0rDyMueZKeY8o4vynOAEQmCOJWJbrkhU=
vitess.io/vitess v0.10.3-0.20240115103031-ca4246d93812/go.mod h1:h03CHnbFzUMOVVxA9hLgBircydRKqeeyjhDqBjZmp+0=
vitess.io/vitess v0.10.3-0.20240121130840-6c4c5faa7029 h1:NCyzmpKcBfJLomOgvhn1Rg7dJjcsnY511SvpPuI5ZZE=
vitess.io/vitess v0.10.3-0.20240121130840-6c4c5faa7029/go.mod h1:W7loalC1u4Ke/QdTHZLKqUzmgN2Qr4+491q8ClTn7xY=
4 changes: 2 additions & 2 deletions pkg/base/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@ func ReadSQLsFromSource(env *schemadiff.Environment, inputSourceValue string) (s
if err != nil {
return nil, vterrors.Wrapf(err, "reading standard output")
}
return env.Parser.SplitStatementToPieces(strings.TrimSpace(string(b)))
return env.Parser().SplitStatementToPieces(strings.TrimSpace(string(b)))
case FileInputSource:
// Read given file. It may contain any number (zero included) number of CREATE TABLE|VIEW statements,
// delimtied by ';'
b, err := os.ReadFile(inputSourceValue)
if err != nil {
return nil, vterrors.Wrapf(err, "reading file %s", inputSourceValue)
}
return env.Parser.SplitStatementToPieces(strings.TrimSpace(string(b)))
return env.Parser().SplitStatementToPieces(strings.TrimSpace(string(b)))
case DirectoryInputSource:
// Read all .sql files in this directory. Each file assumed to contain a single CREATE TABLE}VIEW statememt.
var sqls []string
Expand Down
8 changes: 3 additions & 5 deletions pkg/core/exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@ import (
"strings"
"time"

"vitess.io/vitess/go/mysql/collations"
"vitess.io/vitess/go/vt/schemadiff"
"vitess.io/vitess/go/vt/sqlparser"
"vitess.io/vitess/go/vt/vtenv"
)

var (
Expand All @@ -26,14 +25,13 @@ func Exec(ctx context.Context, command string, source string, target string) (ou
ctx, cancel := context.WithTimeout(ctx, timeout)
defer cancel()

collEnv := collations.NewEnvironment(mysqlVersion)
parser, err := sqlparser.New(sqlparser.Options{
venv, err := vtenv.New(vtenv.Options{
MySQLServerVersion: mysqlVersion,
})
if err != nil {
return "", err
}
env := schemadiff.NewEnv(collEnv, collEnv.DefaultConnectionCharset(), parser, mysqlVersion)
env := schemadiff.NewEnv(venv, venv.CollationEnv().DefaultConnectionCharset())
var bld strings.Builder
getDiffs := func(ordered bool) (err error) {
if source == target {
Expand Down