gnocchi alembic migrations not compatible with alembic 0.8.1

Bug #1488190 reported by Chris Dent
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Gnocchi
Fix Released
High
Julien Danjou

Bug Description

In our constraint free world we've now got alembic 0.8.1 that has this change:

http://alembic.readthedocs.org/en/latest/changelog.html#change-0fbe5d57da5d0fc69adb44615b46a83f

which causes the gnocchi.tests.indexer.sqlalchemy.test_migrations.ModelsMigrationsSync.test_models_sync test to fail. Downgrading to alembic 0.8.0 fixes it.

zzzeek said:

[5:58pm] zzzeek: dims__: a likely reason is alembic 0.8.1
[5:58pm] zzzeek: dims__ / cdent : http://alembic.readthedocs.org/en/latest/changelog.html#change-0fbe5d57da5d0fc69adb44615b46a83f
[5:59pm] • cdent reads
[5:59pm] zzzeek: cdent: yes these FKs have ondelete=RESTRICT in them
[5:59pm] zzzeek: cdent: need that on both sides

Trace from the test:

gnocchi.tests.indexer.sqlalchemy.test_migrations.ModelsMigrationsSync.test_models_sync
--------------------------------------------------------------------------------------

Captured traceback:
~~~~~~~~~~~~~~~~~~~
    Traceback (most recent call last):
      File "/home/cdent/src/gnocchi/.tox/py27/lib/python2.7/site-packages/oslo_db/sqlalchemy/test_migrations.py", line 603, in test_models_sync
        "Models and migration scripts aren't in sync:\n%s" % msg)
      File "/home/cdent/src/gnocchi/.tox/py27/lib/python2.7/site-packages/unittest2/case.py", line 690, in fail
        raise self.failureException(msg)
    AssertionError: Models and migration scripts aren't in sync:
    [ ( 'remove_fk',
        ForeignKeyConstraint(<sqlalchemy.sql.base.ColumnCollection object at 0x7fb401fe4b90>, None, name=u'fk_archive_policy_rule_archive_policy_name_archive_policy_name', table=Table('archive_policy_rule', MetaData(bind=None), Column('name', VARCHAR(length=255), table=<archive_policy_rule>, primary_key=True, nullable=False), Column('archive_policy_name', VARCHAR(length=255), ForeignKey(u'archive_policy.name'), ForeignKey(u'archive_policy.name'), table=<archive_policy_rule>, nullable=False), Column('metric_pattern', VARCHAR(length=255), table=<archive_policy_rule>, nullable=False), schema=None))),
      ( 'add_fk',
        ForeignKeyConstraint(<sqlalchemy.sql.base.ColumnCollection object at 0x7fb403eebef0>, None, name='fk_archive_policy_rule_archive_policy_name_archive_policy_name', ondelete='RESTRICT', table=Table('archive_policy_rule', MetaData(bind=None), Column('name', String(length=255), table=<archive_policy_rule>, primary_key=True, nullable=False), Column('archive_policy_name', String(length=255), ForeignKey('archive_policy.name'), table=<archive_policy_rule>, nullable=False), Column('metric_pattern', String(length=255), table=<archive_policy_rule>, nullable=False), schema=None))),
      ( 'remove_fk',
        ForeignKeyConstraint(<sqlalchemy.sql.base.ColumnCollection object at 0x7fb401f8a560>, None, name=u'fk_metric_archive_policy_name_archive_policy_name', table=Table('metric', MetaData(bind=None), Column('id', BINARY(length=16), table=<metric>, primary_key=True, nullable=False), Column('archive_policy_name', VARCHAR(length=255), ForeignKey(u'archive_policy.name'), ForeignKey(u'archive_policy.name'), table=<metric>, nullable=False), Column('created_by_user_id', BINARY(length=16), table=<metric>), Column('created_by_project_id', BINARY(length=16), table=<metric>), Column('resource_id', BINARY(length=16), ForeignKey(u'resource.id'), ForeignKey(u'resource.id'), table=<metric>), Column('name', VARCHAR(length=255), table=<metric>), schema=None))),
      ( 'add_fk',
        ForeignKeyConstraint(<sqlalchemy.sql.base.ColumnCollection object at 0x7fb403f8df80>, None, name='fk_metric_archive_policy_name_archive_policy_name', ondelete='RESTRICT', table=Table('metric', MetaData(bind=None), Column('id', UUIDType(length=16), table=<metric>, primary_key=True, nullable=False), Column('archive_policy_name', String(length=255), ForeignKey('archive_policy.name'), table=<metric>, nullable=False), Column('created_by_user_id', UUIDType(length=16), table=<metric>), Column('created_by_project_id', UUIDType(length=16), table=<metric>), Column('resource_id', UUIDType(length=16), ForeignKey('resource.id'), table=<metric>), Column('name', String(length=255), table=<metric>), schema=None)))]

Julien Danjou (jdanjou)
Changed in gnocchi:
status: New → Incomplete
status: Incomplete → Triaged
importance: Undecided → High
milestone: none → 1.2.0
assignee: nobody → Julien Danjou (jdanjou)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix proposed to gnocchi (master)

Related fix proposed to branch: master
Review: https://review.openstack.org/216722

Revision history for this message
Julien Danjou (jdanjou) wrote :

After discussing by email with Mike Bayer, it seems that the problem is that MySQL is not reporting the ON DELETE restriction as it's a default. So Alembic can not know it's there.

Mike's going to take a look if he can fix that in Alembic 0.8.2 or if we need to bypass that FK check on Gnocchi's side.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix merged to gnocchi (master)

Reviewed: https://review.openstack.org/216722
Committed: https://git.openstack.org/cgit/openstack/gnocchi/commit/?id=24db9ad1901730081b27a94c1fe43de5fd030a3c
Submitter: Jenkins
Branch: master

commit 24db9ad1901730081b27a94c1fe43de5fd030a3c
Author: Julien Danjou <email address hidden>
Date: Tue Aug 25 15:56:52 2015 +0200

    Exclude Alembic>=0.8.1

    Let's exclude this version of Alembic until we figure out how to
    properly fix this.

    Change-Id: I593e4f91be35016422a248bc1d1e28ada866efc7
    Related-Bug: #1488190

Julien Danjou (jdanjou)
Changed in gnocchi:
status: Triaged → Fix Committed
Julien Danjou (jdanjou)
Changed in gnocchi:
status: Fix Committed → Fix Released
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.