← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1354218] [NEW] heal script is not idempotent

 

Public bug reported:

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)

** Affects: neutron
     Importance: High
     Assignee: Salvatore Orlando (salvatore-orlando)
         Status: New


** Tags: db

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to neutron.
https://bugs.launchpad.net/bugs/1354218

Title:
  heal script is not idempotent

Status in OpenStack Neutron (virtual network service):
  New

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)

To manage notifications about this bug go to:
https://bugs.launchpad.net/neutron/+bug/1354218/+subscriptions


Follow ups

References