Skip to content

Commit

Permalink
Update to latest Vitess (#17)
Browse files Browse the repository at this point in the history
This fixes an issue that can also affect psdbproxy, namely
vitessio/vitess#15112. It would result in
sending a wrong initial collation.
  • Loading branch information
dbussink authored Feb 2, 2024
1 parent eb90028 commit 53fac19
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 19 deletions.
8 changes: 4 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,20 @@ require (
github.com/spf13/pflag v1.0.5
// Once Vitess v19 is out, we can move to that but for now
// we depend on latest main here.
vitess.io/vitess v0.10.3-0.20240127133750-f751c8323ff5
vitess.io/vitess v0.10.3-0.20240202095444-ea8a90d0938b
)

require (
github.com/AdaLogics/go-fuzz-headers v0.0.0-20230811130428-ced1acdcaa24 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/klauspost/compress v1.17.4 // indirect
github.com/klauspost/compress v1.17.5 // indirect
github.com/klauspost/connect-compress/v2 v2.0.0 // indirect
github.com/pires/go-proxyproto v0.7.0 // indirect
github.com/segmentio/asm v1.2.0 // indirect
github.com/slok/noglog v0.2.0 // indirect
golang.org/x/sys v0.16.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240116215550-a9fa1716bcac // indirect
google.golang.org/grpc v1.60.1 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240125205218-1f4bbc51befe // indirect
google.golang.org/grpc v1.61.0 // indirect
google.golang.org/protobuf v1.32.0 // indirect
)

Expand Down
16 changes: 8 additions & 8 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiu
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/klauspost/compress v1.17.4 h1:Ej5ixsIri7BrIjBkRZLTo6ghwrEtHFk7ijlczPW4fZ4=
github.com/klauspost/compress v1.17.4/go.mod h1:/dCuZOvVtNoHsyb+cuJD3itjs3NbnF6KH9zAO4BDxPM=
github.com/klauspost/compress v1.17.5 h1:d4vBd+7CHydUqpFBgUEKkSdtSugf9YFmSkvUYPquI5E=
github.com/klauspost/compress v1.17.5/go.mod h1:/dCuZOvVtNoHsyb+cuJD3itjs3NbnF6KH9zAO4BDxPM=
github.com/klauspost/connect-compress/v2 v2.0.0 h1:L7TVsLa6Oo9Hkkb6r3DwSrhBbcWlXjneqBj7fCRXviU=
github.com/klauspost/connect-compress/v2 v2.0.0/go.mod h1:604CD9JSAjGqtVzCM4SRgM/9TFTkWBcp+2wlQfGyJ6c=
github.com/pires/go-proxyproto v0.7.0 h1:IukmRewDQFWC7kfnb66CSomk2q/seBuilHBYFwyq0Hs=
Expand Down Expand Up @@ -43,15 +43,15 @@ 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-20240116215550-a9fa1716bcac h1:nUQEQmH/csSvFECKYRv6HWEyypysidKl2I6Qpsglq/0=
google.golang.org/genproto/googleapis/rpc v0.0.0-20240116215550-a9fa1716bcac/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/genproto/googleapis/rpc v0.0.0-20240125205218-1f4bbc51befe h1:bQnxqljG/wqi4NTXu2+DJ3n7APcEA882QZ1JvhQAq9o=
google.golang.org/genproto/googleapis/rpc v0.0.0-20240125205218-1f4bbc51befe/go.mod h1:PAREbraiVEVGVdTZsVWjSbbTtSyGbAgIIvni8a8CD5s=
google.golang.org/grpc v1.61.0 h1:TOvOcuXn30kRao+gfcvsebNEa5iZIiLkisYEkf7R7o0=
google.golang.org/grpc v1.61.0/go.mod h1:VUbo7IFqmF1QtCAstipjG0GIoq49KvMe9+h1jFLBNJs=
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I=
google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
vitess.io/vitess v0.10.3-0.20240127133750-f751c8323ff5 h1:UpzF1VRBHisGqPPvJKE0S4Pp6uQtWnzsfZsBmpO+VlI=
vitess.io/vitess v0.10.3-0.20240127133750-f751c8323ff5/go.mod h1:j1welz6z7V3Q022QaXG2VRd/VLyOwiOIgFek7ZtC+Rw=
vitess.io/vitess v0.10.3-0.20240202095444-ea8a90d0938b h1:U8oibbhp6fSTCNUxhrUVgifqY3ObOm5VskVnUKMu2gU=
vitess.io/vitess v0.10.3-0.20240202095444-ea8a90d0938b/go.mod h1:OS9UMLc0y9zfPUUGvHqpcURCatpDEgq3U0OzHMyYjr8=
12 changes: 6 additions & 6 deletions handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
"vitess.io/vitess/go/mysql/sqlerror"
"vitess.io/vitess/go/sqltypes"
vitessquerypb "vitess.io/vitess/go/vt/proto/query"
"vitess.io/vitess/go/vt/sqlparser"
"vitess.io/vitess/go/vt/vtenv"
"vitess.io/vitess/go/vt/vterrors"
)

Expand All @@ -26,7 +26,7 @@ var errNotImplemented = errors.New("not implemented")
const mysqlVersion = "8.0.34-psdbproxy"

func (s *Server) handler() (*handler, error) {
parser, err := sqlparser.New(sqlparser.Options{
env, err := vtenv.New(vtenv.Options{
MySQLServerVersion: mysqlVersion,
})
if err != nil {
Expand All @@ -41,7 +41,7 @@ func (s *Server) handler() (*handler, error) {
s.Authorization,
),
connections: map[*mysql.Conn]*clientData{},
parser: parser,
env: env,
}, nil
}

Expand All @@ -54,7 +54,7 @@ type handler struct {
connectionsMu sync.RWMutex
connections map[*mysql.Conn]*clientData

parser *sqlparser.Parser
env *vtenv.Environment
}

func (h *handler) testCredentials(timeout time.Duration) error {
Expand Down Expand Up @@ -303,8 +303,8 @@ func (h *handler) streamExecute(c *mysql.Conn, data *clientData, query string, b
return nil
}

func (h *handler) SQLParser() *sqlparser.Parser {
return h.parser
func (h *handler) Env() *vtenv.Environment {
return h.env
}

func bindSession(c *mysql.Conn, data *clientData, session *psdbpb.Session) {
Expand Down
1 change: 0 additions & 1 deletion server.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ func (s *Server) Serve(l net.Listener) error {
ConnWriteTimeout: 30 * time.Second,
ConnBufferPooling: true,
ConnKeepAlivePeriod: 30 * time.Second,
MySQLServerVersion: mysqlVersion,
})
if err != nil {
return err
Expand Down

0 comments on commit 53fac19

Please sign in to comment.