-
Notifications
You must be signed in to change notification settings - Fork 32
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
feat(support-mysql-8): Added support for mysql version 8.0 and above #170
base: master
Are you sure you want to change the base?
feat(support-mysql-8): Added support for mysql version 8.0 and above #170
Conversation
25a2167
to
6d1792b
Compare
6d1792b
to
62e1c0a
Compare
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 taking care of this.
Left some comments. Some more points:
- Also, a lot of new functions are added without unit tests. I think it makes sense to add tests for the ones that have logical statements.
- Do you think it improves the code if we have an optional argument in config with db version? We won't have to compute version on each execution. If not specified, we anyways do it.
- IMO, the additional dependency is not required. But we can discuss.
- Can
version
throughout the code be replaced withdbVersion
or something similar. It could be confused with integration version.
} | ||
|
||
func threadCacheMissRate(metrics map[string]interface{}) (float64, bool) { | ||
// TODO compute the value within the interval |
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.
I didn't understand the TODO statement here.
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 already existing comment that just moved to different file
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.
We need to understand why it is there. If we think we don't need it, it can be removed.
src/metrics-parse.go
Outdated
func extractSemver(version string) (string, error) { | ||
reg := regexp.MustCompile(`^(?P<major>\d+)(?:\.(?P<minor>\d+))?(?:\.(?P<patch>\d+))?`) | ||
matches := reg.FindStringSubmatch(version) | ||
|
||
if len(matches) == 0 || matches[1] == "" { | ||
return "", errSemanticVersionNotFound | ||
} | ||
|
||
major := matches[1] | ||
minor := "0" | ||
patch := "0" | ||
|
||
if len(matches) > 2 && matches[2] != "" { | ||
minor = matches[2] | ||
} | ||
if len(matches) > 3 && matches[3] != "" { | ||
patch = matches[3] | ||
} | ||
|
||
return fmt.Sprintf("%s.%s.%s", major, minor, patch), nil | ||
} |
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.
I don't think we need this much complexity for getting the version. MySQL Doc specifies that the version might have a suffix but not a prefix. Therefore, you'll always get version before the first -
.
Moreover, the documentation states: This function is unsafe for statement-based replication. A warning is logged if you use this function when [binlog_format](https://dev.mysql.com/doc/refman/8.4/en/replication-options-binary-log.html#sysvar_binlog_format) is set to STATEMENT.
Though the binlog_format
is deprecated, do you think it might cause any issues for older customer environments?
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.
will discuss this with kai
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.
I ran integration tests in github actions for version 5.7.35 with binlog_format=STATEMENT and it passed. I didn’t make any change to handle if we are not able to parse DB version output. So, We are getting the version as excepted without any warning with was mentioned in the Mysql doc.
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.
I think we should just note this in the documentation. Other than that it seems fine.
1dc1da9
to
9a5c77a
Compare
9a5c77a
to
fe29f92
Compare
|
3754b63
to
fe29f92
Compare
fdeaa60
to
5f06db8
Compare
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.
LGTM
Just one point as mentioned in my last comment. It also provides a way to not break the integration if we are unable to get version.
Do you think it improves the code if we have an optional argument in config with db version? We won't have to compute version on each execution. If not specified, we anyways do it.
… the query output
The query cache variables are removed from MySQL 8.0 - https://dev.mysql.com/doc/refman/5.7/en/query-cache-status-and-maintenance.html - Due to this the following metrics will not be support for mysql version 8.0 and above
From MySQL 8.0.23 the statement CHANGE MASTER TO is deprecated. The alias CHANGE REPLICATION SOURCE TO should be used instead. The parameters for the statement also have aliases that replace the term MASTER with the term SOURCE. For example, MASTER_HOST and MASTER_PORT can now be entered as SOURCE_HOST and SOURCE_PORT.
More Info - https://dev.mysql.com/doc/relnotes/mysql/8.0/en/news-8-0-23.html.
Code changes -
Testing details here