yahoo-eng-team team mailing list archive
-
yahoo-eng-team team
-
Mailing list archive
-
Message #08653
[Bug 1252891] Re: DB migration 209 can fail when deleting from instance_actions
** Changed in: nova
Status: Fix Committed => Fix Released
--
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Compute (nova).
https://bugs.launchpad.net/bugs/1252891
Title:
DB migration 209 can fail when deleting from instance_actions
Status in OpenStack Compute (Nova):
Fix Released
Bug description:
Migration 209 adds foreign key constraints that were defined in the
model but never applied as part of a migration.
Since the foreign key didn't exist previously, there may be rows that
need to be deleted before the foreign key constraint is added.
It does this by selecting the list of rows that reference a
nonexistant row in the parent table. It first dumps the rows into a
dump table and then deletes the rows.
However, the instance_actions table is a parent in a foreign key
relationship with the instance_actions_events table. As a result, if
rows need to be deleted from the instance_actions table, this
exception similar to this will be raised:
File "nova/db/sqlalchemy/migrate_repo/versions/209_add_missing_foreign_keys.py", line 67, in upgrade
migrate_engine.execute(sql_del)
File "site-packages/sqlalchemy/engine/base.py", line 2446, in execute
return connection.execute(statement, *multiparams, **params)
File "site-packages/sqlalchemy/engine/base.py", line 1449, in execute
params)
File "site-packages/sqlalchemy/engine/base.py", line 1584, in _execute_clauseelement
compiled_sql, distilled_params
File "site-packages/sqlalchemy/engine/base.py", line 1698, in _execute_context
context)
File "site-packages/sqlalchemy/engine/base.py", line 1850, in _handle_dbapi_exception
None, sys.exc_info()[2]
IntegrityError: (IntegrityError) (1451, 'Cannot delete or update a parent row: a foreign key constraint fails (`nova`.`instance_actions_events`, CONSTRAINT `instance_actions_events_ibfk_1` FOREIGN KEY (`action_id`) REFERENCES `instance_actions` (`id`))') 'DELETE FROM instance_actions WHERE instance_actions.instance_uuid NOT IN (SELECT instances.uuid \nFROM instances)' ()
To manage notifications about this bug go to:
https://bugs.launchpad.net/nova/+bug/1252891/+subscriptions