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

Auto Detect MySQL Version and Use in vtgate mysql_server_version Flag #10701

Merged
merged 12 commits into from
Jul 18, 2022
11 changes: 11 additions & 0 deletions go/test/endtoend/cluster/vtgate_process.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import (
"time"

"vitess.io/vitess/go/vt/log"
"vitess.io/vitess/go/vt/mysqlctl"
"vitess.io/vitess/go/vt/vtgate/planbuilder"
"vitess.io/vitess/go/vt/vtgate/planbuilder/plancontext"
)
Expand Down Expand Up @@ -69,6 +70,15 @@ const defaultVtGatePlannerVersion = planbuilder.Gen4CompareV3

// Setup starts Vtgate process with required arguements
func (vtgate *VtgateProcess) Setup() (err error) {
version, err := mysqlctl.GetVersionString()
if err != nil {
return err
}
_, vers, err := mysqlctl.ParseVersionString(version)
if err != nil {
return err
}
mysqlvers := fmt.Sprintf("%d.%d.%d-vitess", vers.Major, vers.Minor, vers.Patch)

args := []string{
"--topo_implementation", vtgate.CommonArg.TopoImplementation,
Expand All @@ -85,6 +95,7 @@ func (vtgate *VtgateProcess) Setup() (err error) {
"--tablet_types_to_wait", vtgate.TabletTypesToWait,
"--service_map", vtgate.ServiceMap,
"--mysql_auth_server_impl", vtgate.MySQLAuthServerImpl,
"--mysql_server_version", mysqlvers,
}
if vtgate.PlannerVersion > 0 {
args = append(args, "--planner-version", vtgate.PlannerVersion.String())
Expand Down