Skip to content
This repository has been archived by the owner on Dec 16, 2022. It is now read-only.

Commit

Permalink
Restore support for mysqlctl_mycnf_template
Browse files Browse the repository at this point in the history
Regression of vitessio#5654

Signed-off-by: Morgan Tocker <tocker@gmail.com>
  • Loading branch information
morgo committed Jan 15, 2020
1 parent 5165f85 commit b322579
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions go/vt/mysqlctl/mysqld.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ var (

poolDynamicHostnameResolution = flag.Duration("pool_hostname_resolve_interval", 0, "if set force an update to all hostnames and reconnect if changed, defaults to 0 (disabled)")

socketFile = flag.String("mysqlctl_socket", "", "socket file to use for remote mysqlctl actions (empty for local actions)")
mycnfTemplateFile = flag.String("mysqlctl_mycnf_template", "", "template file to use for generating the my.cnf file during server init")
socketFile = flag.String("mysqlctl_socket", "", "socket file to use for remote mysqlctl actions (empty for local actions)")

// masterConnectRetry is used in 'SET MASTER' commands
masterConnectRetry = flag.Duration("master_connect_retry", 10*time.Second, "how long to wait in between slave -> connection attempts. Only precise to the second.")
Expand Down Expand Up @@ -793,7 +794,14 @@ func (mysqld *Mysqld) initConfig(cnf *Mycnf, outFile string) error {
}

func (mysqld *Mysqld) getMycnfTemplate() string {

if *mycnfTemplateFile != "" {
data, err := ioutil.ReadFile(*mycnfTemplateFile)
if err != nil {
log.Warningf("template file could not be read, using default template instead: %v", *mycnfTemplateFile) // continue to default
} else {
return string(data) // use only specified template
}
}
myTemplateSource := new(bytes.Buffer)
myTemplateSource.WriteString("[mysqld]\n")

Expand Down

0 comments on commit b322579

Please sign in to comment.