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

Restore support for mysqlctl_mycnf_template #5717

Merged
merged 3 commits into from
Jan 21, 2020

Conversation

morgo
Copy link
Contributor

@morgo morgo commented Jan 15, 2020

Regression of #5654

I refactored getMycnfTemplates and accidentally removed mycnfTemplateFile, then the linter told me the option was not used anywhere. This was in error :-)

Signed-off-by: Morgan Tocker tocker@gmail.com

Regression of vitessio#5654

Signed-off-by: Morgan Tocker <tocker@gmail.com>
Signed-off-by: Morgan Tocker <tocker@gmail.com>
Copy link
Contributor

@setassociative setassociative left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks for this revision!

if *mycnfTemplateFile != "" {
data, err := ioutil.ReadFile(*mycnfTemplateFile)
if err != nil {
log.Fatalf("mycnf template file could not be read: %v", *mycnfTemplateFile)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we only want to log a FATAL or do we want to abort (exit) at this point?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not quite sure I follow. A log.Fatalf triggers an exit(1) at the same time. Here is an example with a modified local example:

morgo@ryzen:~/vitess/examples/local$ ./101_initial_cluster.sh 
add /vitess/global
add /vitess/zone1
add zone1 CellInfo
etcd start done...
Starting vtctld...
Access vtctld web UI at http://ryzen:15000
Send commands with: vtctlclient -server ryzen:15999 ...
Starting MySQL for tablet zone1-0000000100...
F0120 11:57:04.764601   29998 mysqld.go:800] template file specified by -mysqlctl_mycnf_template could not be read: /home/morgo/vitess/config/mycnf/testcustom.cnf
goroutine 1 [running]:
github.com/golang/glog.stacks(0xc0001a2b00, 0xc0003aa0c0, 0xa3, 0xb6)
	/home/morgo/go/pkg/mod/github.com/golang/glog@v0.0.0-20160126235308-23def4e6c14b/glog.go:769 +0xb1
github.com/golang/glog.(*loggingT).output(0x16aaf20, 0xc000000003, 0xc0003c0310, 0x14d57b8, 0x9, 0x320, 0x0)
	/home/morgo/go/pkg/mod/github.com/golang/glog@v0.0.0-20160126235308-23def4e6c14b/glog.go:720 +0x2f6
github.com/golang/glog.(*loggingT).printf(0x16aaf20, 0xc000000003, 0xda35b3, 0x49, 0xc000386cf0, 0x1, 0x1)
	/home/morgo/go/pkg/mod/github.com/golang/glog@v0.0.0-20160126235308-23def4e6c14b/glog.go:655 +0x14e
github.com/golang/glog.Fatalf(0xda35b3, 0x49, 0xc000386cf0, 0x1, 0x1)
	/home/morgo/go/pkg/mod/github.com/golang/glog@v0.0.0-20160126235308-23def4e6c14b/glog.go:1148 +0x67
vitess.io/vitess/go/vt/mysqlctl.(*Mysqld).getMycnfTemplate(0xc0003c01c0, 0x35, 0x0)
	/home/morgo/vitess/go/vt/mysqlctl/mysqld.go:800 +0x15a
vitess.io/vitess/go/vt/mysqlctl.(*Mysqld).initConfig(0xc0003c01c0, 0xc00039c120, 0xc0003b4050, 0x41, 0x0, 0xd78e00)
	/home/morgo/vitess/go/vt/mysqlctl/mysqld.go:783 +0x40c
vitess.io/vitess/go/vt/mysqlctl.(*Mysqld).InitConfig(0xc0003c01c0, 0xc00039c120, 0x0, 0x0)
	/home/morgo/vitess/go/vt/mysqlctl/mysqld.go:628 +0x17f
vitess.io/vitess/go/vt/mysqlctl.(*Mysqld).Init(0xc0003c01c0, 0xeab9e0, 0xc0000b6ae0, 0xc00039c120, 0x0, 0x0, 0x0, 0x0)
	/home/morgo/vitess/go/vt/mysqlctl/mysqld.go:640 +0x89
main.initCmd(0xc0000b6600, 0xc0000e6090, 0x0, 0x0, 0x0, 0x0)
	/home/morgo/vitess/go/cmd/mysqlctl/mysqlctl.go:77 +0x324
main.main()
	/home/morgo/vitess/go/cmd/mysqlctl/mysqlctl.go:258 +0x416
ERROR: This script fails to start mysqld, possibly due to apparmor or selinux protection.     
        Utilities to help investigate:    
                apparmor: "sudo aa-status"    
                selinux:  "sudo sestatus"    
        Please disable if so indicated.    
        You may also need to empty your $VTDATAROOT to start clean.

I would actually prefer without the go stack trace, but that is something implemented by our logging library.

Mention config var which is causing the failure.

Signed-off-by: Morgan Tocker <tocker@gmail.com>
Copy link
Member

@deepthi deepthi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants