Nutmeg upgrade: outlines.py: "openedx.core.djangoapps.content.learning_sequences.models.LearningContext.DoesNotExist: LearningContext matching query does not exist"

Congrats folks! I’m super happy that this worked out for you. However…

I think we need to be very careful about how any changes to edx-platform and tutor will affect large, existing databases, and what the proper upgrade path for them is going to be. If the upgrade process is going to have to be disruptive (e.g. turn the site off, back up gigabytes or terabytes of data, and re-import with new settings), it might be worth combining this with whatever else is necessary for the MySQL 8.0 migration. For instance, the collation we will ultimately want is likely utf8mb4_0900_ai_ci, which isn’t available in 5.7.

@regis: Do you have thoughts on the migration path for something like this in Tutor?

FYI @jmbowman, who I know has thought about the MySQL 8.0 issue a lot.

hopefully we can get Open edX to work with mysql 8 in the near future

I believe the code for edx-platform has already been made compatible. We check the database migrations against both MySQL 5.7 and 8.0 in GitHub actions. But I don’t know of anyone who’s made the leap to actually deploying under MySQL 8.0 yet, so there may be weird edge cases that crop up.

@regis: Does it make sense to move tutor nightly dev over to use MySQL 8.0 with the newer encoding settings? Or make it opt-in with a couple of config settings for encoding and collation? I can take a stab at that PR if you think that’s a viable approach.

I have no idea what a migration to utf8mb4 or MySQL 8 entails, but it would be great if we could get Open edX to run with this collation. However:

  • We must be pretty certain that Open edX runs on MySQL 8/utf8mb4.
  • This migration must only happen during a release upgrade; for instance, it would be great to to add it to Olive.
  • The migration must not be optional (opt-in) or experimental. If it is, then it should be in a plugin.

That being said, if we as a community are committed to the MySQL 8 migration or the collation change, then I’ll be happy to take PRs.

Thanks @regis. I’ll kick off a new thread for that discussion.

1 Like

Created new thead: Upgrading MySQL charset to utf8mb4

This approach worked for us at MIT Open Learning as well.

1 Like

And you didn’t encounter any bugs or problems on your side?

While trying to reproduce these manipulations directly from MySQL8, I got the following error message when importing the database converted utf8mb3 to utf8mb4:
ERROR 1146 (42S02) at line 2584: Table 'openedx.learning_sequences_coursesection' doesn't exist

I double check my manipulations and come back with an update.

UPDATE: Upgrading MySQL charset to utf8mb4 - #2 by Abdess

Hi all,
I am upgrading from Ironwood to Nutmeg!! I found that I had to do a step by step migration through all the intermediate versions to make it work.

I had to change the default charset at the very first step to avoid a confusing IntegrityError, just after applying the sql dump to the db, and before running migrations for Juniper.

To check the default charset, run (replacing edxapp with the actual name of the db)

SELECT default_character_set_name FROM information_schema.SCHEMATA S WHERE schema_name = "edxapp";

If the output is not utf-8, then update with:

ALTER DATABASE edxapp CHARACTER SET utf8 COLLATE utf8_general_ci

Repeat the same with the notes and the discovery databases.

It is curious that, even if you set the charset initially in the source and the target databases, once I apply the sql dump to the target, the charset is cleared and I had to apply it afterwards.

Now, everything went fine until the final migration from Maple to Nutmeg, where I got exactly the CourseOutlineData.DoesNotExist error.

But then running tutor local run cms ./manage.py cms simulate_publish fixed the problem and everything looks fine now.

1 Like

I followed these steps and I think it worked (though I can’t fully tell yet, as my student account is having a different issue now accessing my emoji-containing class, and other non-emoji-containing ones AFAICT). But if I view the emoji-containing class from studio, “as learner”, it does show emojis, so maybe that means it’s fixed?

Edit: Confirmed it’s fixed, after I got help on the other issue. Thanks a bunch @Abdess! Now hopefully they’ll fix this for everyone so we don’t need to deal with breakage again after the next upgrade.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.