Rollout

This plan involves preemptively expanding the username column to varchar(150).   We would not be vulnerable to ungraceful registration failures since usernames larger than 30 characters (let alone 150) will not pass ORM validation anyway.  Downtime taken is uncoupled from the 1.11 deployment.  We have confirmed that Django 1.11 will not validate and fail if the column type is already changed to varchar(150) before migrating.  Also, running the same exact ALTER TABLE query twice in a row does not cause mysql to lock/rebuild the table the second time.

Contacts

AMIs

EnvironmentDjangoAMI ID
stage-edx-edxapp1.10ami-b978a0c4
prod-edx-edxapp1.10ami-d968b0a4
prod-edge-edxapp1.10ami-d1548cac
stage-edx-edxapp1.11ami-1e5a8263
prod-edx-edxapp1.11ami-4c5f8731
prod-edge-edxapp1.11ami-d25981af

Steps:

Rollback

Migration considerations: DO NOT ROLLBACK THE MIGRATIONS If the migration auth/0008_alter_user_username_max_length was deployed (username column width changed to 150), do not reverse/rollback this even in the event of a code rollback because it requires downtime to change. The third_party_auth/0015_remove_icon_class_image_secondary_fields migration drops columns, but in a table which is currently empty.  The remaining migrations are largely no-ops, so they can be left in the database as ghost migrations for a short period of time until a fix is developed.

Causes for concern/Possible rollback reasons:

Steps:

Adapted from LMS/Studio Rollback#Code.

Rollback edxapp code from Django 1.11 to Django 1.8

Migrations overview

The following migrations would be created by upgrading from Django 1.8 to 1.11:

appnamedjango versionedx-platform table? *notes

admin

0002_logentry_remove_auto_add1.9noThis is a DB no-op.
auth0007_alter_validators_add_error_messages1.9noUnclear to me if this is a no-op, but it certainly was fast in loadtest.
auth0008_alter_user_username_max_length1.10noSuper time consuming in loadtest!
sites0002_alter_domain_unique1.9noNo-op in prod DB because domains are already unique.
certificates0014_change_eligible_certs_manager<= 1.10yes
course_modes0011_change_regex_for_comma_separated_ints<= 1.10yesNew CSV validation will pass, and this migration will not modify the DB.
third_party_auth0015_remove_icon_class_image_secondary_fields<= 1.10yesDrops three columns from table "third_party_auth_ltiproviderconfig"; should be super quick since this table is empty in prod.

* = i.e. is this migration committed to edx-platform codebase.

The auth/0008_alter_user_username_max_length migration took over 1 hour in loadtest before we terminated it.  This is the SQL corresponding to the migration:

$ ./manage.py lms --settings=aws sqlmigrate auth 0008_alter_user_username_max_length
BEGIN;
--
-- Alter field username on user
--
ALTER TABLE `auth_user` MODIFY `username` varchar(150) NOT NULL;
COMMIT;

This migration causes a temp auth_user table to be rebuilt, all while locking the table.  This operation took over an hour in loadtest, presumably because there are so many automatically generated test users.  Running this query against an RDS instance restored from a recent prod snapshot took 22 minutes:

The third_party_auth/0015_remove_icon_class_image_secondary_fields migration has rollback implications because it drops columns from a table.  According to Everything About Database Migrations, we normally avoid dropping columns, but this migration stems from a model derived from Django itself which we have little control over.  Fortunately, this table is currently EMPTY in prod, so In the case of a code rollback back to Django 1.8 this table should be trivial to roll back as well.