-
Notifications
You must be signed in to change notification settings - Fork 445
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
fix: broken mysql after palm upgrade #890
Conversation
Note that we're actively recommending utf8mb4 for new installations, and trying to switch old installations (including edx.org) to it. utf8(mb3) is missing large parts of Unicode needed for many languages (and omits some popular newer emoji). See https://discuss.openedx.org/t/upgrading-mysql-charset-to-utf8mb4/7927 for more details. |
I agree Jeremy and trust me: in general I'm all for upgrading software as much as possible. |
@regisb After further testing, the data corruption I encountered during the upgrade happens because of two issues:
This PR + setting the MySQLv8.0.34 allow an upgrade from v15.3.7 to v16.0.5 without any data corruption. The PR should be updated to include the MySQL version v8.0.34 EDIT: source https://dev.mysql.com/doc/relnotes/mysql/8.0/en/news-8-0-34.html |
f70f84f
to
f199ef5
Compare
OK, I suggest we upgrade directly to MySQL 8.1.0, as this releases seems to fix a large number of bugs: https://dev.mysql.com/doc/relnotes/mysql/8.1/en/news-8-1-0.html There are two categories of users:
I don't know how to handle group 1. I want to check that this change does not break Open edX for users in group 2. If it doesn't, then I'll merge this PR quickly. |
This fix is for a rather serious issue that affects users who upgrade from Olive to Palm. The client mysql charset and collation was incorrectly set to utf8mb4, while the server stil runs utf8mb3. Only users who run the mysql container are affected. To resolve this issue, we explicitely configure the client to use the utf8mb3 charset/collation. Important note: users who have somehow managed to upgrade from olive to Palm before may find themselves in an undefined state. They might have to fix their mysql data manually. Same thing for users who launched Palm from scratch; although, according to my preliinary tests, they should be able to downgrade their connection from utf8mb4 to utf8mb3 without issue. In addition, we upgrade to mysql 8.1.0. Among many other fixes, this avoids a server restart after the upgrade: > An in-place upgrade from MySQL 5.7 to MySQL 8.0, without a server > restart, could result in unexpected errors when executing queries on > tables. This fix eliminates the need to restart the server between the > upgrade and queries. (Bug #35410528) https://dev.mysql.com/doc/relnotes/mysql/8.0/en/news-8-0-34.html See also the 8.1.0 release notes: https://dev.mysql.com/doc/relnotes/mysql/8.1/en/news-8-1-0.html Close #887.
f199ef5
to
703a35f
Compare
I just tested an upgrade of an existing 16.0.5 platform, so I'm going to merge this now and release 16.1.0. |
I tested from v16.0.1 with the PR changes and no issue with data corruption or the collation. |
Thanks for your help @nratineau! |
@nratineau: Just so I'm clear: Does the corruption still happen if the connection is made with |
EDIT: This was wrong. See below. |
@regisb: Please pardon my paranoid checking here, but I really want to make sure I understand this issue and what it means for our future migration plans.
Why did Django connect using |
Please keep asking questions! I'm eager to get to the bottom of this, and I'm not sure I'm able to understand all the elements myself.
I'm not sure. I'll outline my discoveries here, though none of them are conclusive yet. Evidence 1:
|
In "Evidence 5", what is the exact version of MySQL being used? |
I used 8.0.33 for all my tests. |
@regisb: Django emits When you try to run this same test with MySQL 8.0.34 or 8.1.0, does it break down in the same set of apps, or does it happen with a different set? |
@adzuci: Wanted to make sure that you saw this, since this complicates plans to do incremental upgrades to |
Just taking the liberty to back-link the Discourse thread related to this subject. (Side note: it would be terrific if this could somehow be automated, that is, a bot creating a comment linking to any Discourse thread that a GitHub issue or PR is mentioned in.) |
OK I've done some more research and I think I've finally found the root cause, which is not at all related to the utf8mb3 charset. Instead the issue is caused by that MySQL bug #35410528:
The bug is described more extensively in the upstream commit for the fix: mysql/mysql-server@bbcb9bc Thus, the following are all working fixes:
For the record, I was wrong when I made that comment about 8.0.34 not fixing the issue. I'm not sure why I was led to believe that upgrading by itself did not resolve the issue. I must have made an error during my many experiments. Still, I think that we want to keep the changes that were made in this PR. Being explicit about the client charset cannot hurt, as long as we don't force that charset for users who run their own MySQL cluster. |
@regisb: Fantastic news! Thank you so much for tracking this all the way down. I learned a lot just from following your debugging descriptions. @adzuci: It looks like this clears the way for us to at least start tiptoeing towards migrating larger installations in smaller chunks and experiment with connecting via |
Thanks for your help @ormsbee! For the record I did try the
When it yielded only results with utf8mb3 charsets, I knews I had to look elsewhere. |
This fix is for a rather serious issue that affects users who upgrade from Olive to Palm. The client mysql charset and collation was incorrectly set to utf8mb4, while the server stil runs utf8mb3. Only users who run the mysql container are affected.
To resolve this issue, we explicitely configure the client to use the utf8mb3 charset/collation.
Important note: users who have somehow managed to upgrade from olive to Palm before may find themselves in an undefined state. They might have to fix their mysql data manually. Same thing for users who launched Palm from scratch; although, according to my preliinary tests, they should be able to downgrade their connection from utf8mb4 to utf8mb3 without issue.
Close #887.