← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1363332] [NEW] Database migration downgrade to havana fails

 

Public bug reported:

The first migration script after havana (e197124d4b9) has a bad
downgrade.

INFO  [alembic.migration] Running downgrade e197124d4b9 -> havana, add unique constraint to members
Traceback (most recent call last):
  File "/home/henry/Dev/neutron/.tox/py27/bin/neutron-db-manage", line 10, in <module>
    sys.exit(main())
  File "/home/henry/Dev/neutron/neutron/db/migration/cli.py", line 175, in main
    CONF.command.func(config, CONF.command.name)
  File "/home/henry/Dev/neutron/neutron/db/migration/cli.py", line 85, in do_upgrade_downgrade
    do_alembic_command(config, cmd, revision, sql=CONF.command.sql)
  File "/home/henry/Dev/neutron/neutron/db/migration/cli.py", line 63, in do_alembic_command
    getattr(alembic_command, cmd)(config, *args, **kwargs)
  File "/home/henry/Dev/neutron/.tox/py27/local/lib/python2.7/site-packages/alembic/command.py", line 151, in downgrade
    script.run_env()
  File "/home/henry/Dev/neutron/.tox/py27/local/lib/python2.7/site-packages/alembic/script.py", line 203, in run_env
    util.load_python_file(self.dir, 'env.py')
  File "/home/henry/Dev/neutron/.tox/py27/local/lib/python2.7/site-packages/alembic/util.py", line 215, in load_python_file
    module = load_module_py(module_id, path)
  File "/home/henry/Dev/neutron/.tox/py27/local/lib/python2.7/site-packages/alembic/compat.py", line 58, in load_module_py
    mod = imp.load_source(module_id, path, fp)
  File "/home/henry/Dev/neutron/neutron/db/migration/alembic_migrations/env.py", line 120, in <module>
    run_migrations_online()
  File "/home/henry/Dev/neutron/neutron/db/migration/alembic_migrations/env.py", line 108, in run_migrations_online
    options=build_options())
  File "<string>", line 7, in run_migrations
  File "/home/henry/Dev/neutron/.tox/py27/local/lib/python2.7/site-packages/alembic/environment.py", line 689, in run_migrations
    self.get_context().run_migrations(**kw)
  File "/home/henry/Dev/neutron/.tox/py27/local/lib/python2.7/site-packages/alembic/migration.py", line 263, in run_migrations
    change(**kw)
  File "/home/henry/Dev/neutron/neutron/db/migration/alembic_migrations/versions/e197124d4b9_add_unique_constrain.py", line 62, in downgrade
    type_='unique'
  File "<string>", line 7, in drop_constraint
  File "<string>", line 1, in <lambda>
  File "/home/henry/Dev/neutron/.tox/py27/local/lib/python2.7/site-packages/alembic/util.py", line 332, in go
    return fn(*arg, **kw)
  File "/home/henry/Dev/neutron/.tox/py27/local/lib/python2.7/site-packages/alembic/operations.py", line 841, in drop_constraint
    self.impl.drop_constraint(const)
  File "/home/henry/Dev/neutron/.tox/py27/local/lib/python2.7/site-packages/alembic/ddl/impl.py", line 138, in drop_constraint
    self._exec(schema.DropConstraint(const))
  File "/home/henry/Dev/neutron/.tox/py27/local/lib/python2.7/site-packages/alembic/ddl/impl.py", line 76, in _exec
    conn.execute(construct, *multiparams, **params)
  File "/home/henry/Dev/neutron/.tox/py27/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 729, in execute
    return meth(self, multiparams, params)
  File "/home/henry/Dev/neutron/.tox/py27/local/lib/python2.7/site-packages/sqlalchemy/sql/ddl.py", line 69, in _execute_on_connection
    return connection._execute_ddl(self, multiparams, params)
  File "/home/henry/Dev/neutron/.tox/py27/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 783, in _execute_ddl
    compiled
  File "/home/henry/Dev/neutron/.tox/py27/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 958, in _execute_context
    context)
  File "/home/henry/Dev/neutron/.tox/py27/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1156, in _handle_dbapi_exception
    util.raise_from_cause(newraise, exc_info)
  File "/home/henry/Dev/neutron/.tox/py27/local/lib/python2.7/site-packages/sqlalchemy/util/compat.py", line 199, in raise_from_cause
    reraise(type(exception), exception, tb=exc_tb)
  File "/home/henry/Dev/neutron/.tox/py27/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 951, in _execute_context
    context)
  File "/home/henry/Dev/neutron/.tox/py27/local/lib/python2.7/site-packages/sqlalchemy/engine/default.py", line 436, in do_execute
    cursor.execute(statement, parameters)
  File "/home/henry/Dev/neutron/.tox/py27/local/lib/python2.7/site-packages/MySQLdb/cursors.py", line 205, in execute
    self.errorhandler(self, exc, value)
  File "/home/henry/Dev/neutron/.tox/py27/local/lib/python2.7/site-packages/MySQLdb/connections.py", line 36, in defaulterrorhandler
    raise errorclass, errorvalue
sqlalchemy.exc.OperationalError: (OperationalError) (1553, "Cannot drop index 'uniq_member0pool_id0address0port': needed in a foreign key constraint") 'ALTER TABLE members DROP INDEX uniq_member0pool_id0address0port' ()

** Affects: neutron
     Importance: Undecided
     Assignee: Henry Gessau (gessau)
         Status: New


** Tags: db

** Changed in: neutron
     Assignee: (unassigned) => Henry Gessau (gessau)

** Tags added: 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/1363332

Title:
  Database migration downgrade to havana fails

Status in OpenStack Neutron (virtual network service):
  New

Bug description:
  The first migration script after havana (e197124d4b9) has a bad
  downgrade.

  INFO  [alembic.migration] Running downgrade e197124d4b9 -> havana, add unique constraint to members
  Traceback (most recent call last):
    File "/home/henry/Dev/neutron/.tox/py27/bin/neutron-db-manage", line 10, in <module>
      sys.exit(main())
    File "/home/henry/Dev/neutron/neutron/db/migration/cli.py", line 175, in main
      CONF.command.func(config, CONF.command.name)
    File "/home/henry/Dev/neutron/neutron/db/migration/cli.py", line 85, in do_upgrade_downgrade
      do_alembic_command(config, cmd, revision, sql=CONF.command.sql)
    File "/home/henry/Dev/neutron/neutron/db/migration/cli.py", line 63, in do_alembic_command
      getattr(alembic_command, cmd)(config, *args, **kwargs)
    File "/home/henry/Dev/neutron/.tox/py27/local/lib/python2.7/site-packages/alembic/command.py", line 151, in downgrade
      script.run_env()
    File "/home/henry/Dev/neutron/.tox/py27/local/lib/python2.7/site-packages/alembic/script.py", line 203, in run_env
      util.load_python_file(self.dir, 'env.py')
    File "/home/henry/Dev/neutron/.tox/py27/local/lib/python2.7/site-packages/alembic/util.py", line 215, in load_python_file
      module = load_module_py(module_id, path)
    File "/home/henry/Dev/neutron/.tox/py27/local/lib/python2.7/site-packages/alembic/compat.py", line 58, in load_module_py
      mod = imp.load_source(module_id, path, fp)
    File "/home/henry/Dev/neutron/neutron/db/migration/alembic_migrations/env.py", line 120, in <module>
      run_migrations_online()
    File "/home/henry/Dev/neutron/neutron/db/migration/alembic_migrations/env.py", line 108, in run_migrations_online
      options=build_options())
    File "<string>", line 7, in run_migrations
    File "/home/henry/Dev/neutron/.tox/py27/local/lib/python2.7/site-packages/alembic/environment.py", line 689, in run_migrations
      self.get_context().run_migrations(**kw)
    File "/home/henry/Dev/neutron/.tox/py27/local/lib/python2.7/site-packages/alembic/migration.py", line 263, in run_migrations
      change(**kw)
    File "/home/henry/Dev/neutron/neutron/db/migration/alembic_migrations/versions/e197124d4b9_add_unique_constrain.py", line 62, in downgrade
      type_='unique'
    File "<string>", line 7, in drop_constraint
    File "<string>", line 1, in <lambda>
    File "/home/henry/Dev/neutron/.tox/py27/local/lib/python2.7/site-packages/alembic/util.py", line 332, in go
      return fn(*arg, **kw)
    File "/home/henry/Dev/neutron/.tox/py27/local/lib/python2.7/site-packages/alembic/operations.py", line 841, in drop_constraint
      self.impl.drop_constraint(const)
    File "/home/henry/Dev/neutron/.tox/py27/local/lib/python2.7/site-packages/alembic/ddl/impl.py", line 138, in drop_constraint
      self._exec(schema.DropConstraint(const))
    File "/home/henry/Dev/neutron/.tox/py27/local/lib/python2.7/site-packages/alembic/ddl/impl.py", line 76, in _exec
      conn.execute(construct, *multiparams, **params)
    File "/home/henry/Dev/neutron/.tox/py27/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 729, in execute
      return meth(self, multiparams, params)
    File "/home/henry/Dev/neutron/.tox/py27/local/lib/python2.7/site-packages/sqlalchemy/sql/ddl.py", line 69, in _execute_on_connection
      return connection._execute_ddl(self, multiparams, params)
    File "/home/henry/Dev/neutron/.tox/py27/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 783, in _execute_ddl
      compiled
    File "/home/henry/Dev/neutron/.tox/py27/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 958, in _execute_context
      context)
    File "/home/henry/Dev/neutron/.tox/py27/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1156, in _handle_dbapi_exception
      util.raise_from_cause(newraise, exc_info)
    File "/home/henry/Dev/neutron/.tox/py27/local/lib/python2.7/site-packages/sqlalchemy/util/compat.py", line 199, in raise_from_cause
      reraise(type(exception), exception, tb=exc_tb)
    File "/home/henry/Dev/neutron/.tox/py27/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 951, in _execute_context
      context)
    File "/home/henry/Dev/neutron/.tox/py27/local/lib/python2.7/site-packages/sqlalchemy/engine/default.py", line 436, in do_execute
      cursor.execute(statement, parameters)
    File "/home/henry/Dev/neutron/.tox/py27/local/lib/python2.7/site-packages/MySQLdb/cursors.py", line 205, in execute
      self.errorhandler(self, exc, value)
    File "/home/henry/Dev/neutron/.tox/py27/local/lib/python2.7/site-packages/MySQLdb/connections.py", line 36, in defaulterrorhandler
      raise errorclass, errorvalue
  sqlalchemy.exc.OperationalError: (OperationalError) (1553, "Cannot drop index 'uniq_member0pool_id0address0port': needed in a foreign key constraint") 'ALTER TABLE members DROP INDEX uniq_member0pool_id0address0port' ()

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


Follow ups

References