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

remove prefixdb and replace with mysql driver params #2871

Merged
merged 1 commit into from
Jul 17, 2017

Conversation

jmhodges
Copy link
Contributor

@jmhodges jmhodges commented Jul 16, 2017

This uses the mysql driver library's capability to use SET to set the system
variables that prefixdb previously was.

Unfortunately, the library doesn't sort the params when making the string, so we
have to do a little munging to TestNewDbMap.

Ran it in a checkout of the repo since godeps now doesn't include the test files (which is great!).

MYSQL_TEST_ADDR=127.0.0.1:3306 go test .
ok  	github.com/go-sql-driver/mysql	46.099s

This uses the mysql driver library's capability to use `SET` to set the system
variables that prefixdb previously was.
@jmhodges
Copy link
Contributor Author

Hello! First PR in a while. This is output that came about as a side-effect of go-sql-driver/mysql#635 and also me not having read some docs and needing to do a penance.

I could break the mysql driver update into another PR if you'd prefer.

// In MariaDB, max_statement_time and long_query_time are both seconds.
// Note: in MySQL (which we don't use), max_statement_time is millis.
readTimeout := conf.ReadTimeout.Seconds()
conf.Params["max_statement_time"] = fmt.Sprintf("%g", readTimeout*0.95)
Copy link
Contributor

Choose a reason for hiding this comment

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

@jsha: random aside, we were prviously using it but do we really want to be using %g here? Documentation for it says %e for large exponents, %f otherwise where %e is scientific notation, e.g. -1.234456e+78. Can MariaDB really understand scientific notation or should we just be using %f consistently?

Copy link
Contributor

Choose a reason for hiding this comment

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

MariaDB understands scientific notation, so this can stay.

@rolandshoemaker
Copy link
Contributor

One small nit that may not need to be fixed but generally LGTM. Could you run the tests for the new vendored version of github.com/go-sql-driver/mysql and put the results in the PR body per CONTRIBUTING.md.

Thanks!

@jsha
Copy link
Contributor

jsha commented Jul 17, 2017

Same as Roland: LGTM, but please document in the PR desc that you ran tests in the vendored code.

@jmhodges
Copy link
Contributor Author

Ran it in a checkout of the repo since godeps now doesn't include the test files (which is great!).

MYSQL_TEST_ADDR=127.0.0.1:3306 go test .
ok  	github.com/go-sql-driver/mysql	46.099s

@jsha jsha merged commit b88750e into letsencrypt:master Jul 17, 2017
@jmhodges
Copy link
Contributor Author

The price is paid and penance completed.

Thanks!

@jmhodges jmhodges deleted the remove_prefixdb branch July 31, 2017 07:07
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