*** This bug is a duplicate of bug 1160114 *** https://bugs.launchpad.net/bugs/1160114
** This bug has been marked a duplicate of bug 1160114 test_postgresql_opportunistically fails on RHEL -- You received this bug notification because you are a member of Yahoo! Engineering Team, which is subscribed to Glance. https://bugs.launchpad.net/bugs/1173269 Title: db migration 022 question Status in OpenStack Image Registry and Delivery Service (Glance): Confirmed Bug description: I suspect the latest glance db migration has a bug; I'm not certain but here's the evidence when running against a mysql backend. It could be that my initial state is iffy, but I thought I'd report it anyway. Its migration 022. It changes the image_members table. If I run the migration with rows in the table it seems to fail with a foreign key constraint, but it exits with an error about 'cant DROP key'. The bum steer on the error is due to not printing out the initial exception. $ sudo glance-manage db_sync 10156 INFO glance.db.sqlalchemy.migration [- - -] Upgrading database to version latest 10156 CRITICAL glance [- - -] (OperationalError) (1091, "Can't DROP 'image_members_image_id_key'; check that column/key exists") 'ALTER TABLE image_members DROP INDEX image_members_image_id_key' () 2013-04-25 11:55:34.807 10156 TRACE glance Traceback (most recent call last): 2013-04-25 11:55:34.807 10156 TRACE glance File "/usr/bin/glance-manage", line 134, in <module> 2013-04-25 11:55:34.807 10156 TRACE glance main() 2013-04-25 11:55:34.807 10156 TRACE glance File "/usr/bin/glance-manage", line 128, in main 2013-04-25 11:55:34.807 10156 TRACE glance CONF.command.func() 2013-04-25 11:55:34.807 10156 TRACE glance File "/usr/bin/glance-manage", line 80, in do_db_sync 2013-04-25 11:55:34.807 10156 TRACE glance CONF.command.current_version) 2013-04-25 11:55:34.807 10156 TRACE glance File "/usr/lib/python2.7/dist-packages/glance/db/sqlalchemy/migration.py", line 127, in db_sync 2013-04-25 11:55:34.807 10156 TRACE glance upgrade(version=version) 2013-04-25 11:55:34.807 10156 TRACE glance File "/usr/lib/python2.7/dist-packages/glance/db/sqlalchemy/migration.py", line 66, in upgrade 2013-04-25 11:55:34.807 10156 TRACE glance return versioning_api.upgrade(sql_connection, repo_path, version) 2013-04-25 11:55:34.807 10156 TRACE glance File "/usr/lib/python2.7/dist-packages/migrate/versioning/api.py", line 186, in upgrade 2013-04-25 11:55:34.807 10156 TRACE glance return _migrate(url, repository, version, upgrade=True, err=err, **opts) 2013-04-25 11:55:34.807 10156 TRACE glance File "<string>", line 2, in _migrate 2013-04-25 11:55:34.807 10156 TRACE glance File "/usr/lib/python2.7/dist-packages/migrate/versioning/util/__init__.py", line 159, in with_engine 2013-04-25 11:55:34.807 10156 TRACE glance return f(*a, **kw) 2013-04-25 11:55:34.807 10156 TRACE glance File "/usr/lib/python2.7/dist-packages/migrate/versioning/api.py", line 366, in _migrate 2013-04-25 11:55:34.807 10156 TRACE glance schema.runchange(ver, change, changeset.step) 2013-04-25 11:55:34.807 10156 TRACE glance File "/usr/lib/python2.7/dist-packages/migrate/versioning/schema.py", line 91, in runchange 2013-04-25 11:55:34.807 10156 TRACE glance change.run(self.engine, step) 2013-04-25 11:55:34.807 10156 TRACE glance File "/usr/lib/python2.7/dist-packages/migrate/versioning/script/py.py", line 145, in run 2013-04-25 11:55:34.807 10156 TRACE glance script_func(engine) 2013-04-25 11:55:34.807 10156 TRACE glance File "/usr/lib/python2.7/dist-packages/glance/db/sqlalchemy/migrate_repo/versions/022_image_member_index.py", line 43, in upgrade 2013-04-25 11:55:34.807 10156 TRACE glance table=image_members).drop() 2013-04-25 11:55:34.807 10156 TRACE glance File "/usr/lib/python2.7/dist-packages/migrate/changeset/constraint.py", line 59, in drop 2013-04-25 11:55:34.807 10156 TRACE glance self.__do_imports('constraintdropper', *a, **kw) 2013-04-25 11:55:34.807 10156 TRACE glance File "/usr/lib/python2.7/dist-packages/migrate/changeset/constraint.py", line 32, in __do_imports 2013-04-25 11:55:34.807 10156 TRACE glance run_single_visitor(engine, visitorcallable, self, *a, **kw) 2013-04-25 11:55:34.807 10156 TRACE glance File "/usr/lib/python2.7/dist-packages/migrate/changeset/databases/visitor.py", line 75, in run_single_visitor 2013-04-25 11:55:34.807 10156 TRACE glance fn(element, **kwargs) 2013-04-25 11:55:34.807 10156 TRACE glance File "/usr/lib/python2.7/dist-packages/migrate/changeset/ansisql.py", line 272, in visit_migrate_unique_constraint 2013-04-25 11:55:34.807 10156 TRACE glance self._visit_constraint(*p, **k) 2013-04-25 11:55:34.807 10156 TRACE glance File "/usr/lib/python2.7/dist-packages/migrate/changeset/ansisql.py", line 284, in _visit_constraint 2013-04-25 11:55:34.807 10156 TRACE glance self.execute() 2013-04-25 11:55:34.807 10156 TRACE glance File "/usr/lib/python2.7/dist-packages/migrate/changeset/ansisql.py", line 42, in execute 2013-04-25 11:55:34.807 10156 TRACE glance return self.connection.execute(self.buffer.getvalue()) 2013-04-25 11:55:34.807 10156 TRACE glance File "/usr/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 1405, in execute 2013-04-25 11:55:34.807 10156 TRACE glance params) 2013-04-25 11:55:34.807 10156 TRACE glance File "/usr/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 1582, in _execute_text 2013-04-25 11:55:34.807 10156 TRACE glance statement, parameters 2013-04-25 11:55:34.807 10156 TRACE glance File "/usr/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 1646, in _execute_context 2013-04-25 11:55:34.807 10156 TRACE glance context) 2013-04-25 11:55:34.807 10156 TRACE glance File "/usr/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 1639, in _execute_context 2013-04-25 11:55:34.807 10156 TRACE glance context) 2013-04-25 11:55:34.807 10156 TRACE glance File "/usr/lib/python2.7/dist-packages/sqlalchemy/engine/default.py", line 330, in do_execute 2013-04-25 11:55:34.807 10156 TRACE glance cursor.execute(statement, parameters) 2013-04-25 11:55:34.807 10156 TRACE glance File "/usr/lib/python2.7/dist-packages/MySQLdb/cursors.py", line 174, in execute 2013-04-25 11:55:34.807 10156 TRACE glance self.errorhandler(self, exc, value) 2013-04-25 11:55:34.807 10156 TRACE glance File "/usr/lib/python2.7/dist-packages/MySQLdb/connections.py", line 36, in defaulterrorhandler 2013-04-25 11:55:34.807 10156 TRACE glance raise errorclass, errorvalue 2013-04-25 11:55:34.807 10156 TRACE glance OperationalError: (OperationalError) (1091, "Can't DROP 'image_members_image_id_key'; check that column/key exists") 'ALTER TABLE image_members DROP INDEX image_members_image_id_key' () 2013-04-25 11:55:34.807 10156 TRACE glance mysql> show columns from image_members; +------------+--------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +------------+--------------+------+-----+---------+----------------+ | created_at | datetime | NO | | NULL | | | updated_at | datetime | NO | | NULL | | | deleted_at | datetime | YES | | NULL | | | deleted | tinyint(1) | NO | | NULL | | | id | int(11) | NO | PRI | NULL | auto_increment | | image_id | varchar(36) | NO | MUL | NULL | | | member | varchar(255) | NO | | NULL | | | can_share | tinyint(1) | NO | | NULL | | | status | varchar(20) | YES | | NULL | | +------------+--------------+------+-----+---------+----------------+ 9 rows in set (0.00 sec) mysql> select * from image_members; +---------------------+---------------------+------------+---------+----+--------------------------------------+--------+-----------+---------+ | created_at | updated_at | deleted_at | deleted | id | image_id | member | can_share | status | +---------------------+---------------------+------------+---------+----+--------------------------------------+--------+-----------+---------+ | 2013-04-18 20:25:30 | 2013-04-18 20:25:30 | NULL | 0 | 1 | 7a12474f-1fdc-40ac-9cf1-41649b16dd68 | 112233 | 0 | pending | +---------------------+---------------------+------------+---------+----+--------------------------------------+--------+-----------+---------+ 1 row in set (0.00 sec) mysql> The actual error is (OperationalError) (1553, "Cannot drop index 'image_id': needed in a foreign key constraint") 'ALTER TABLE image_members DROP INDEX image_id' () You get the REAL error by catching the exception in the migration code and printing it out - the traceback is from the except clause's attempt to carry on. To manage notifications about this bug go to: https://bugs.launchpad.net/glance/+bug/1173269/+subscriptions -- Mailing list: https://launchpad.net/~yahoo-eng-team Post to : yahoo-eng-team@lists.launchpad.net Unsubscribe : https://launchpad.net/~yahoo-eng-team More help : https://help.launchpad.net/ListHelp