-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
mysql: Ensure we set up the initial collation correctly #15115
Conversation
Review ChecklistHello reviewers! 👋 Please follow this checklist when reviewing this Pull Request. General
Tests
Documentation
New flags
If a workflow is added or modified:
Backward compatibility
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for looking at this so quickly! I've pulled this down and built it locally, and I confirm that this works, and PHP is happy to establish the connection again. 🎉
connectionID: 1, | ||
connReadTimeout: cfg.ConnReadTimeout, | ||
connWriteTimeout: cfg.ConnWriteTimeout, | ||
connReadBufferSize: cfg.ConnReadBufferSize, | ||
connBufferPooling: cfg.ConnBufferPooling, | ||
connKeepAlivePeriod: cfg.ConnKeepAlivePeriod, | ||
flushDelay: cfg.FlushDelay, | ||
truncateErrLen: cfg.TruncateErrLen, | ||
truncateErrLen: cfg.Handler.Env().TruncateErrLen(), | ||
charset: cfg.Handler.Env().CollationEnv().DefaultConnectionCharset(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
@@ -315,15 +306,16 @@ func NewListenerWithConfig(cfg ListenerConfig) (*Listener, error) { | |||
authServer: cfg.AuthServer, | |||
handler: cfg.Handler, | |||
listener: l, | |||
ServerVersion: cfg.MySQLServerVersion, | |||
ServerVersion: cfg.Handler.Env().MySQLVersion(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can Handler and/or Env() be nil here? IMO it's worth a safety check here that returns an error or even an explicit panic with a message if it really shouldn't happen and we can't proceed. Same for the cfg.Handler
chains below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should never ever be nil under any circumstance. That it panics in that case is good. I don't think we should guard this, as it means many guards all over the place then (the env is used in many other places too).
The collation env refactor missed a bunch of setup for the MySQL listener, which resulted in a missing initial collation on the connection. This fixes that and adds additional assertions as well. Signed-off-by: Dirkjan Bussink <[email protected]>
Signed-off-by: Dirkjan Bussink <[email protected]>
6a8f4d3
to
08408dc
Compare
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #15115 +/- ##
=======================================
Coverage 70.63% 70.63%
=======================================
Files 1375 1375
Lines 182222 182217 -5
=======================================
+ Hits 128705 128708 +3
+ Misses 53517 53509 -8 ☔ View full report in Codecov by Sentry. |
The collation env refactor missed a bunch of setup for the MySQL listener, which resulted in a missing initial collation on the connection.
This fixes that and adds additional assertions as well.
Related Issue(s)
Fixes #15112
Checklist