Initial 'nova db sync' migration fails on mysql (if InnoDB was used since the beginning)

Bug #816236 reported by Adam Gandelman
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
High
Josh Kearney

Bug Description

On Ubuntu natty with nova 2011.3~d3~20110726.1320-0ubuntu0ppa1~natty1, the initial 'nova db sync' fails:

(nova): TRACE: OperationalError: (OperationalError) (1025, "Error on rename of './nova/#sql-9a3_10f' to './nova/migrations' (errno: 150)") '\nALTER TABLE migrations DROP COLUMN instance_id' ()

...because migrations.instance_id is part of a foreign key reference that must first be deleted:

mysql> show create table migrations;
<..snip..>
  KEY `instance_id` (`instance_id`),
  CONSTRAINT `migrations_ibfk_1` FOREIGN KEY (`instance_id`) REFERENCES `instances` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 |

Modifying db/sqlalchemy/migrate_repo/versions/034_change_instance_id_in_migrations.py to delete this foreign key before dropping table allows migrations to complete successfully.

Related branches

Revision history for this message
Adam Gandelman (gandelman-a) wrote :
Changed in nova:
importance: Undecided → Critical
milestone: none → diablo-3
status: New → Triaged
Revision history for this message
Thierry Carrez (ttx) wrote :

Can't reproduce...

Changed in nova:
importance: Critical → Undecided
status: Triaged → Incomplete
Revision history for this message
Thierry Carrez (ttx) wrote :

This only happens if the database was originally created as InnoDB (and not migrated to InnoDB at 022_set_engine_mysql_innodb.py). To reproduce, add 'default_storage_engine = InnoDB' to the [mysqld] section of /etc/mysql/my.cnf before creating the nova database.

Changed in nova:
importance: Undecided → High
status: Incomplete → Confirmed
Thierry Carrez (ttx)
summary: - Initial 'nova db sync' migration failure on mysql due to foreign key
- reference
+ Initial 'nova db sync' migration fails on mysql (if InnoDB was used
+ since the beginning)
Josh Kearney (jk0)
Changed in nova:
status: Confirmed → In Progress
assignee: nobody → Josh Kearney (jk0)
Josh Kearney (jk0)
Changed in nova:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in nova:
milestone: diablo-3 → 2011.3
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.