-
Notifications
You must be signed in to change notification settings - Fork 52
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
Add collation settings to allow collation to override charset #155
Conversation
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.
👍 Looks good but just pattern matching based on existing code looks like we might want to rename one of the vars here.
… host'; both are acceptable responses
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.
👍 collation bits look good to me.
My only other thought is whether it's possible to add a test for this change? but otherwise 👍.
@@ -51,8 +51,8 @@ func TestProxySQLGetDB(t *testing.T) { | |||
if err == nil { | |||
t.Fatal("expected error for failed connection") | |||
} | |||
if !strings.HasSuffix(err.Error(), "no such host") { | |||
t.Fatalf("expected a 'no such host' error, got %v", err) | |||
if !strings.HasSuffix(err.Error(), "no such host") && !strings.HasSuffix(err.Error(), "i/o timeout") { |
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.
Is this change meant to be in this PR?
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.
This is to fix a test failure when run in Actions, as the invalid host lookup now times out instead of returning "no such host" (but the important thing for this test is that connecting to an invalid hostname fails, which is still the case with this change). I've not dug further into why this has changed.
Good shout - done 👍 There is a lot of logic driven from |
This PR introduces two new settings:
ConfigurationSettings
->BackendCollation
- if specified, setscollation=?
in the DSN for the backend MySQL database connection, replacing the defaultcharset=utf8mb4,utf8,latin1
settingMySQLConfigurationSettings
->Collation
- if specified, setscollation=?
in the DSN for the monitored MySQL stores connections, replacing the defaultcharset=utf8mb4,utf8,latin1
settingWhen these values are set to a charset that is common between MySQL 5.7 and 8.0 (e.g.
utf8mb4_unicode_520_ci
), this prevents Freno from breaking temporary replication from an 8.0 primary to a 5.7 replica.This PR does not change the existing behaviour of Freno (i.e. setting
charset=utf8mb4,utf8,latin1
); instead it allows the existing behaviour to be overriden when the new collation settings are specified.I have not added the new collation parameters to the documentation as they are for a niche use case.
Also in this PR: