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
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/unit_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:

services:
mysql:
image: mysql:8.0.40
image: mysql:8.4
env:
MYSQL_ROOT_PASSWORD: leonardo-test
MYSQL_USER: leonardo-test
Expand Down
4 changes: 2 additions & 2 deletions docker/run-mysql.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env bash

# The CloudSQL console simply states "MySQL 8.0" so we may not match the minor version number
MYSQL_VERSION=8.0.40
# The CloudSQL console simply states "MySQL 8.4" so we may not match the minor version number
MYSQL_VERSION=8.4
start() {

echo "attempting to remove old $CONTAINER container..."
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<databaseChangeLog logicalFilePath="leonardo" xmlns="http://www.liquibase.org/xml/ns/dbchangelog" xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.4.xsd">
<changeSet logicalFilePath="leonardo" author="thibault" id="label">
<validCheckSum>8:1d8581dc0977ea88b1f006f6bc00f5b9</validCheckSum>
<comment>
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

<createTable tableName="LABEL">
<column name="clusterId" type="BIGINT">
<constraints nullable="false"/>
Expand Down
Loading