Alembic migration fails with MySQL 5.7

Bug #1590145 reported by Stephen Balukoff
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
octavia
Fix Released
Undecided
Stephen Balukoff

Bug Description

When attempting to set up Octavia on devstack using MySQL 5.7 as the back-end database, the alembic migration chain fails with the following error:

sqlalchemy.exc.DataError: (pymysql.err.DataError) (1171, u'All parts of a PRIMARY KEY must be NOT NULL; if you need NULL in a key, use UNIQUE instead') [SQL: u'ALTER TABLE sni MODIFY tls_container_id VARCHAR(128) NULL']

This is being caused by the following migration, which expands the length of the 'tls_container_id' field in the 'sni' table:

8c0851bdf6c3_change_tls_container_id_length_in_sni_.py

Specifically, older versions of MySQL allowed primary keys composed of multiple fields to have parts which could be set to NULL. MySQL 5.7 does not.

As this field should never be null, the above migration need to be fixed so that it doesn't change the field into a nullable field, and an additional migration should be added so that migrations run on existing installations using MySQL 5.6 or newer also set this field to be non-nullable.

Revision history for this message
Stephen Balukoff (sbalukoff) wrote :

Not sure why this didn't automatically link, but a fix is underway here: https://review.openstack.org/#/c/326723

Changed in octavia:
assignee: nobody → Stephen Balukoff (sbalukoff)
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to octavia (master)

Reviewed: https://review.openstack.org/326723
Committed: https://git.openstack.org/cgit/openstack/octavia/commit/?id=2d72ac69df756d9f48cc9b82df16eb760f144eec
Submitter: Jenkins
Branch: master

commit 2d72ac69df756d9f48cc9b82df16eb760f144eec
Author: Stephen Balukoff <email address hidden>
Date: Tue Jun 7 13:44:44 2016 -0700

    Fix alembic migration on MySQL 5.7

    Presently, attempting to run alembic migrations for Octavia on a host
    using MySQL 5.7 as the database back-end fails with an error about a
    nullable field in a primary key. This commit fixes the offending
    migration and introduces a second, similar migration so that any
    existing installation using MySQL 5.6 or older also have this field set
    to be non-nullable.

    Change-Id: Iae3d4f627c1124b1d913aab283e6e19d9c0f0dbb
    Closes-Bug: #1590145

Changed in octavia:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/octavia 0.9.0

This issue was fixed in the openstack/octavia 0.9.0 release.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.