heal script is not idempotent

Bug #1354218 reported by Salvatore Orlando
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
neutron
Fix Released
High
Ann Taraday

Bug Description

tested with mysql
1) upgrade head
2) downgrade havana
3) upgrade head
4) BOOM -> http://paste.openstack.org/show/91769/
5) This is easy [1]
6) Try 1-3 again
7) BOOM -> http://paste.openstack.org/show/91770/
8) This is easy as well [2]
9) Repeat again steps 1-3
10) BOOM -> http://paste.openstack.org/show/91771/

I'm clueless so far about the last failure.

[1]

--- a/neutron/db/migration/alembic_migrations/heal_script.py
+++ b/neutron/db/migration/alembic_migrations/heal_script.py
@@ -103,12 +103,12 @@ def parse_modify_command(command):
     # autoincrement=None, existing_type=None,
     # existing_server_default=False, existing_nullable=None,
     # existing_autoincrement=None, schema=None, **kw)
+ bind = op.get_bind()
     for modified, schema, table, column, existing, old, new in command:
         if modified.endswith('type'):
             modified = 'type_'
         elif modified.endswith('nullable'):
             modified = 'nullable'
- bind = op.get_bind()
             insp = sqlalchemy.engine.reflection.Inspector.from_engine(bind)
             if column in insp.get_primary_keys(table) and new:
                 return

[2]
--- a/neutron/db/migration/alembic_migrations/heal_script.py
+++ b/neutron/db/migration/alembic_migrations/heal_script.py
@@ -103,12 +103,12 @@ def parse_modify_command(command):
     # autoincrement=None, existing_type=None,
     # existing_server_default=False, existing_nullable=None,
     # existing_autoincrement=None, schema=None, **kw)
+ bind = op.get_bind()
     for modified, schema, table, column, existing, old, new in command:
         if modified.endswith('type'):
             modified = 'type_'
         elif modified.endswith('nullable'):
             modified = 'nullable'
- bind = op.get_bind()
             insp = sqlalchemy.engine.reflection.Inspector.from_engine(bind)
             if column in insp.get_primary_keys(table) and new:
                 return
@@ -123,7 +123,7 @@ def parse_modify_command(command):
                 existing['existing_server_default'] = default.arg
             else:
                 existing['existing_server_default'] = default.arg.compile(
- dialect=bind.engine.name)
+ dialect=bind.dialect)
         kwargs.update(existing)
         op.alter_column(table, column, **kwargs)

Tags: db
Changed in neutron:
assignee: Salvatore Orlando (salvatore-orlando) → Ann Kamyshnikova (akamyshnikova)
Changed in neutron:
status: New → Confirmed
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to neutron (master)

Fix proposed to branch: master
Review: https://review.openstack.org/116833

Changed in neutron:
status: Confirmed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to neutron (master)

Reviewed: https://review.openstack.org/116833
Committed: https://git.openstack.org/cgit/openstack/neutron/commit/?id=661e3ec795be075eb8f66ff15de1c8ad3603a682
Submitter: Jenkins
Branch: master

commit 661e3ec795be075eb8f66ff15de1c8ad3603a682
Author: Ann Kamyshnikova <email address hidden>
Date: Tue Aug 26 12:24:20 2014 +0400

    Fix heal_script for MySQL specifics

    After running upgrade head->downgrade havana->upgrade head
    on MySQL heal_script fails with several mistakes.

    This change fix them. More details in related bug description.

    Closes-bug: #1354218

    Change-Id: I91cb21c4bc744f240bfb8bc6b2ed24b6e01f6095

Changed in neutron:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in neutron:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in neutron:
milestone: juno-3 → 2014.2
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.