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

[AN-257] Pin mysql to 8.4 for local leo and unit tests #4819

Merged
merged 2 commits into from
Jan 15, 2025

Conversation

LizBaldo
Copy link
Collaborator

@LizBaldo LizBaldo commented Dec 19, 2024

Jira ticket: https://broadworkbench.atlassian.net/browse/AN-257

Summary of changes

What

  • Points the local leo mysql database to use 8.4 for both local runs, as well as unit testing via GHA
    Slight changes to some liquibase migration files to adapt to the mysql 8.0 -> 8.4 breaking changes around allowing FK to reference from a partial PK. Note that I added the checksum validations for each table as to not break dev and staging like [AN-256] Update mysql version to 8.0 for unit test and local leo #4802 did 🤦‍♀️

Why

  • 8.4 buys us 5 extra years compared to 8.0 so it would be great to upgrade to that!

Testing these changes

Note that we need to first merge this terra helmfile PR to update swatomation BEEs to use 8.4, then the integration tests on this PR will pass. We should then merge this PR ASAP otherwise BEE creation will fail for everybody else 😬

What to test

Who tested and where

  • This change is covered by automated tests
    • NB: Rerun automation tests on this PR by commenting jenkins retest or jenkins multi-test.
  • I validated this change
  • Primary reviewer validated this change
  • I validated this change in the dev environment

@LizBaldo LizBaldo requested a review from a team as a code owner December 19, 2024 15:58
Copy link

codecov bot commented Dec 19, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 74.62%. Comparing base (dce08ef) to head (d92234f).
Report is 1 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff            @@
##           develop    #4819   +/-   ##
========================================
  Coverage    74.62%   74.62%           
========================================
  Files          166      166           
  Lines        14692    14692           
  Branches      1135     1135           
========================================
  Hits         10964    10964           
  Misses        3728     3728           

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update dce08ef...d92234f. Read the comment docs.

Mysql 8.4+ does not allow partial keys to be referenced for a foreign key anymore, see https://bugs.mysql.com/bug.php?id=114838.
This changeSet has been modified to reflect that; the validCheckSum is the checksum from when the flag did not need to be set because the default was OFF.
</comment>
<sql> SET restrict_fk_on_non_standard_key = OFF; </sql>
Copy link
Contributor

Choose a reason for hiding this comment

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

This retroactive change would allow this Liquibase to run on a brand new MySQL 8.4 – what happens for existing CloudSQL instances like Prod?

I wonder if we also need a new changeset that will run on those and idempotently set this flag.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It worked great on a preexisting BEE DB, but I can wait until I test the existing dev DB first before merging this that's a good callout

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm also cool with merging as-is and revisiting in a follow-on; since this PR refers to local & tests.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It does, but there is no rush to merge this, I can test mycloud sql locally too

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Everything works great on a dev clone locally. Adding the changeset would not impact the pre-existing database so this is safe to merge as is. I will bring up the issue of potentially drifting our DB config between Broad and Manifold at the tech lead round table though.

Copy link
Contributor

Choose a reason for hiding this comment

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

Sounds good.

I wonder whether Liquibase sets it as a global or session variable. If session, then new & old instances wouldn't drift at all.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It can be set as both, see https://dev.mysql.com/doc/refman/8.4/en/server-system-variables.html#sysvar_restrict_fk_on_non_standard_key

But in this case it is a session variable, because I did not set it as SET GLOBAL

Copy link
Contributor

@aednichols aednichols left a comment

Choose a reason for hiding this comment

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

Clearly an improvement; provisional thumb in case you decide to address existing CloudSQLs seprately.

@LizBaldo LizBaldo merged commit b244c9c into develop Jan 15, 2025
22 checks passed
@LizBaldo LizBaldo deleted the AN-257-mysql-upgrade-to-8.4-local-unit-tests branch January 15, 2025 18:27
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