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

Auto Detect MySQL Version and Use in vtgate mysql_server_version Flag #10701

Merged
merged 12 commits into from
Jul 18, 2022

Conversation

mattlord
Copy link
Contributor

@mattlord mattlord commented Jul 15, 2022

Description

We were using the default value for the vtgate --mysql_server_version flag of 5.7.9-vitess even when the tests were using MySQL 8.0. This work auto detects the MySQL version that will be used for the tests and uses that in the vtgate --mysql_server_version flag unless a specific mysql_server_version has been specified for the test. This way we retain the ability to use custom values for this flag when needed, while otherwise defaulting to a reasonable version.

This will allow us to move more tests to MySQL 8.0 in a seamless way over the coming months as 5.7 is slated for EOL in October, 2023.

⚠️ This PR exposed a bug in v14+ that could cause incorrect collation handling and vtgate crashes: #10712. This PR addresses that as well, which is why I added the Backport to: release-14.0 label.

Related Issue(s)

Checklist

  • Should this PR be backported?
  • Tests were added or are not required
  • Documentation was added or is not required

@vitess-bot
Copy link
Contributor

vitess-bot bot commented Jul 15, 2022

Review Checklist

Hello reviewers! 👋 Please follow this checklist when reviewing this Pull Request.

General

  • Ensure that the Pull Request has a descriptive title.
  • If this is a change that users need to know about, please apply the release notes (needs details) label so that merging is blocked unless the summary release notes document is included.
  • If a new flag is being introduced, review whether it is really needed. The flag names should be clear and intuitive (as far as possible), and the flag's help should be descriptive. Additionally, flag names should use dashes (-) as word separators rather than underscores (_).
  • If a workflow is added or modified, each items in Jobs should be named in order to mark it as required. If the workflow should be required, the GitHub Admin should be notified.

Bug fixes

  • There should be at least one unit or end-to-end test.
  • The Pull Request description should either include a link to an issue that describes the bug OR an actual description of the bug and how to reproduce, along with a description of the fix.

Non-trivial changes

  • There should be some code comments as to why things are implemented the way they are.

New/Existing features

  • Should be documented, either by modifying the existing documentation or creating new documentation.
  • New features should have a link to a feature request issue or an RFC that documents the use cases, corner cases and test cases.

Backward compatibility

  • Protobuf changes should be wire-compatible.
  • Changes to _vt tables and RPCs need to be backward compatible.
  • vtctl command output order should be stable and awk-able.

@mattlord mattlord changed the title Tests: Auto detect MySQL Version and Use in vtgate --mysql_server_version flag Tests: Auto Detect MySQL Version and Use in vtgate mysql_server_version Flag Jul 15, 2022
Copy link
Member

@GuptaManan100 GuptaManan100 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 to me! We might have to remove the mysql_server_version being set in some tests that are currently doing it because we now do it in this central place.

@mattlord
Copy link
Contributor Author

Looks good to me! We might have to remove the mysql_server_version being set in some tests that are currently doing it because we now do it in this central place.

I pushed another commit removing any other place we used a static string in the endtoend tests: c5cf717

If it causes tests failures then I'll either revert that or investigate and fix the failures.

Copy link
Member

@frouioui frouioui 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 to me!

@mattlord mattlord changed the title Tests: Auto Detect MySQL Version and Use in vtgate mysql_server_version Flag Auto Detect MySQL Version and Use in vtgate mysql_server_version Flag Jul 17, 2022
Copy link
Collaborator

@vmg vmg left a comment

Choose a reason for hiding this comment

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

I like this approach, a lot of the engine/planner tests have always been written for 8.0 and porting them to 5.7 right before 5.7 is EOL seems wasteful.

@systay

This comment was marked as resolved.

@systay

This comment was marked as resolved.

@mattlord mattlord merged commit aa2e01d into vitessio:main Jul 18, 2022
@mattlord mattlord deleted the vtgate_tests_mysql_vers branch July 18, 2022 13:22
mattlord added a commit to planetscale/vitess that referenced this pull request Jul 18, 2022
…vitessio#10701)

* Auto detect MySQL version and use in vtgate --mysql_server_version flag

Signed-off-by: Matt Lord <[email protected]>

* Remove any explicit static usage of mysql_server_version

Signed-off-by: Matt Lord <[email protected]>

* The reservedconns test needs to override the mysql_server_version

Signed-off-by: Matt Lord <[email protected]>

* Explicitly allow overriding the mysql_system_version

Signed-off-by: Matt Lord <[email protected]>

* minimize diff

Signed-off-by: Matt Lord <[email protected]>

* Fix vitessio#10712

Signed-off-by: Matt Lord <[email protected]>

* Use more robust string comparisons

Signed-off-by: Matt Lord <[email protected]>

* Fix collation handling in tests

Signed-off-by: Matt Lord <[email protected]>

* Fix tm_init_test

Signed-off-by: Matt Lord <[email protected]>

* Fix more unit tests

Signed-off-by: Matt Lord <[email protected]>

* Another test fix

Signed-off-by: Matt Lord <[email protected]>

* Fix another test that requires 8.0 collations

Signed-off-by: Matt Lord <[email protected]>
mattlord added a commit that referenced this pull request Jul 20, 2022
…er_version Flag (#10733)

* Auto Detect MySQL Version and Use in vtgate mysql_server_version Flag (#10701)

* Auto detect MySQL version and use in vtgate --mysql_server_version flag

Signed-off-by: Matt Lord <[email protected]>

* Remove any explicit static usage of mysql_server_version

Signed-off-by: Matt Lord <[email protected]>

* The reservedconns test needs to override the mysql_server_version

Signed-off-by: Matt Lord <[email protected]>

* Explicitly allow overriding the mysql_system_version

Signed-off-by: Matt Lord <[email protected]>

* minimize diff

Signed-off-by: Matt Lord <[email protected]>

* Fix #10712

Signed-off-by: Matt Lord <[email protected]>

* Use more robust string comparisons

Signed-off-by: Matt Lord <[email protected]>

* Fix collation handling in tests

Signed-off-by: Matt Lord <[email protected]>

* Fix tm_init_test

Signed-off-by: Matt Lord <[email protected]>

* Fix more unit tests

Signed-off-by: Matt Lord <[email protected]>

* Another test fix

Signed-off-by: Matt Lord <[email protected]>

* Fix another test that requires 8.0 collations

Signed-off-by: Matt Lord <[email protected]>

* Kick the CI :-|

Signed-off-by: Matt Lord <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug Report: vtgate crashes executing SELECT CAST("test" AS CHAR(60))
5 participants