Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/release-17.0' into backport-1405…
Browse files Browse the repository at this point in the history
…6-to-release-17.0

Signed-off-by: Florent Poinsard <[email protected]>
  • Loading branch information
frouioui committed Sep 22, 2023
2 parents f5c19d4 + 173e6af commit 7e267ce
Showing 1 changed file with 24 additions and 5 deletions.
29 changes: 24 additions & 5 deletions go/test/endtoend/cluster/mysqlctl_process.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,21 @@ type MysqlctlProcess struct {
ExtraArgs []string
InitMysql bool
SecureTransport bool
MajorVersion int
}

// InitDb executes mysqlctl command to add cell info
func (mysqlctl *MysqlctlProcess) InitDb() (err error) {
args := []string{"--log_dir", mysqlctl.LogDirectory,
"--tablet_uid", fmt.Sprintf("%d", mysqlctl.TabletUID),
"--mysql_port", fmt.Sprintf("%d", mysqlctl.MySQLPort),
"init", "--",
"--init_db_sql_file", mysqlctl.InitDBFile}
"init",
}
if mysqlctl.MajorVersion < 18 {
args = append(args, "--")
}

args = append(args, "--init_db_sql_file", mysqlctl.InitDBFile)
if *isCoverage {
args = append([]string{"--test.coverprofile=" + getCoveragePath("mysql-initdb.out"), "--test.v"}, args...)
}
Expand Down Expand Up @@ -143,11 +149,18 @@ ssl_key={{.ServerKey}}
}

if init {
tmpProcess.Args = append(tmpProcess.Args, "init", "--",
"--init_db_sql_file", mysqlctl.InitDBFile)
tmpProcess.Args = append(tmpProcess.Args, "init")
if mysqlctl.MajorVersion < 18 {
tmpProcess.Args = append(tmpProcess.Args, "--")
}

tmpProcess.Args = append(tmpProcess.Args, "--init_db_sql_file", mysqlctl.InitDBFile)
} else {
tmpProcess.Args = append(tmpProcess.Args, "start")
}
} else {
tmpProcess.Args = append(tmpProcess.Args, "start")
}
tmpProcess.Args = append(tmpProcess.Args, "start")
log.Infof("Starting mysqlctl with command: %v", tmpProcess.Args)
return tmpProcess, tmpProcess.Start()
}
Expand Down Expand Up @@ -238,11 +251,17 @@ func MysqlCtlProcessInstanceOptionalInit(tabletUID int, mySQLPort int, tmpDirect
if err != nil {
return nil, err
}

version, err := GetMajorVersion("mysqlctl")
if err != nil {
log.Warningf("failed to get major mysqlctl version; backwards-compatibility for CLI changes may not work: %s", err)
}
mysqlctl := &MysqlctlProcess{
Name: "mysqlctl",
Binary: "mysqlctl",
LogDirectory: tmpDirectory,
InitDBFile: initFile,
MajorVersion: version,
}
mysqlctl.MySQLPort = mySQLPort
mysqlctl.TabletUID = tabletUID
Expand Down

0 comments on commit 7e267ce

Please sign in to comment.