Duplicate entry '9fe2ff9ee4384b1894a90878d3e92bab' on db_sync

Bug #1133608 reported by Dolph Mathews
16
This bug affects 3 people
Affects Status Importance Assigned to Milestone
OpenStack Identity (keystone)
Confirmed
High
Adam Young
keystone (Ubuntu)
Triaged
High
James Page
Raring
Triaged
High
James Page

Bug Description

From the mailing list:

I have trying to install Keystone Grizzly-3 and cannot get past the following error. The "keystone-manage db_sync" command is generating the following error. I have tried deleting and re-creating the MySQL database (connection = mysql://keystonedbadmin:password@15.253.59.37/keystone) but the error remains. Has anyone else run into this problem and found a solution? I noticed the role ID value 9fe2ff9ee4384b1894a90878d3e92bab in file "/usr/local/lib/python2.7/dist-packages/keystone-2013.1.g3-py2.7.egg/keystone/config.py".

root@build-HP-Compaq-6005-Pro-SFF-PC:~/keystone-2013.1.g3/keystone-2013.1.g3# keystone-manage db_sync
Traceback (most recent call last):
  File "/usr/local/bin/keystone-manage", line 5, in <module>
    pkg_resources.run_script('keystone==2013.1.g3', 'keystone-manage')
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 499, in run_script
    self.require(requires)[0].run_script(script_name, ns)
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 1235, in run_script
    execfile(script_filename, namespace, namespace)
  File "/usr/local/lib/python2.7/dist-packages/keystone-2013.1.g3-py2.7.egg/EGG-INFO/scripts/keystone-manage", line 28, in <module>
    cli.main(argv=sys.argv, config_files=config_files)
  File "/usr/local/lib/python2.7/dist-packages/keystone-2013.1.g3-py2.7.egg/keystone/cli.py", line 172, in main
    CONF.command.cmd_class.main()
  File "/usr/local/lib/python2.7/dist-packages/keystone-2013.1.g3-py2.7.egg/keystone/cli.py", line 53, in main
    driver.db_sync()
  File "/usr/local/lib/python2.7/dist-packages/keystone-2013.1.g3-py2.7.egg/keystone/identity/backends/sql.py", line 171, in db_sync
    migration.db_sync()
  File "/usr/local/lib/python2.7/dist-packages/keystone-2013.1.g3-py2.7.egg/keystone/common/sql/migration.py", line 52, in db_sync
    return versioning_api.upgrade(CONF.sql.connection, repo_path, version)
  File "/usr/lib/python2.7/dist-packages/migrate/versioning/api.py", line 186, in upgrade
    return _migrate(url, repository, version, upgrade=True, err=err, **opts)
  File "<string>", line 2, in _migrate
  File "/usr/lib/python2.7/dist-packages/migrate/versioning/util/__init__.py", line 159, in with_engine
    return f(*a, **kw)
  File "/usr/lib/python2.7/dist-packages/migrate/versioning/api.py", line 366, in _migrate
    schema.runchange(ver, change, changeset.step)
  File "/usr/lib/python2.7/dist-packages/migrate/versioning/schema.py", line 91, in runchange
    change.run(self.engine, step)
  File "/usr/lib/python2.7/dist-packages/migrate/versioning/script/py.py", line 145, in run
    script_func(engine)
  File "/usr/local/lib/python2.7/dist-packages/keystone-2013.1.g3-py2.7.egg/keystone/common/sql/migrate_repo/versions/017_membership_role.py", line 42, in upgrade
    'enabled': 'True'}))
  File "/usr/local/lib/python2.7/dist-packages/SQLAlchemy-0.7.9-py2.7-linux-x86_64.egg/sqlalchemy/engine/base.py", line 1449, in execute
    params)
  File "/usr/local/lib/python2.7/dist-packages/SQLAlchemy-0.7.9-py2.7-linux-x86_64.egg/sqlalchemy/engine/base.py", line 1584, in _execute_clauseelement
    compiled_sql, distilled_params
  File "/usr/local/lib/python2.7/dist-packages/SQLAlchemy-0.7.9-py2.7-linux-x86_64.egg/sqlalchemy/engine/base.py", line 1698, in _execute_context
    context)
  File "/usr/local/lib/python2.7/dist-packages/SQLAlchemy-0.7.9-py2.7-linux-x86_64.egg/sqlalchemy/engine/base.py", line 1691, in _execute_context
    context)
  File "/usr/local/lib/python2.7/dist-packages/SQLAlchemy-0.7.9-py2.7-linux-x86_64.egg/sqlalchemy/engine/default.py", line 331, in do_execute
    cursor.execute(statement, parameters)
  File "/usr/lib/python2.7/dist-packages/MySQLdb/cursors.py", line 174, in execute
    self.errorhandler(self, exc, value)
  File "/usr/lib/python2.7/dist-packages/MySQLdb/connections.py", line 36, in defaulterrorhandler
    raise errorclass, errorvalue
sqlalchemy.exc.IntegrityError: (IntegrityError) (1062, "Duplicate entry '9fe2ff9ee4384b1894a90878d3e92bab' for key 'PRIMARY'") 'INSERT INTO role (id, name, extra)

Revision history for this message
Andreas Hasenack (ahasenack) wrote :

I had the same. I manually removed that row from mysql and ran apt-get -f install. It went past that error then, re-created the _member_ role, but failed elsewhere. I'm now redeploying with g3.

James Page (james-page)
Changed in keystone (Ubuntu Raring):
importance: Undecided → High
status: New → Triaged
Sina Sadeghi (sina-sa)
Changed in keystone:
status: New → Confirmed
tags: added: cloud-archive
Revision history for this message
Sina Sadeghi (sina-sa) wrote :

It's also worth pointing out that a lot of the assumptions about default values which db_sync makes, are very dangerous to existing installations.

Sina Sadeghi (sina-sa)
tags: added: upgrade
Revision history for this message
Dolph Mathews (dolph) wrote :

sina-sa: The default values used by db_sync are configurable via keystone.conf

James Page (james-page)
Changed in keystone (Ubuntu Raring):
assignee: nobody → James Page (james-page)
Revision history for this message
Adam Young (ayoung) wrote :

Cannot reproduce. Something is different between a default install and people who are seeing this. Need to determine what that is.

Revision history for this message
Dolph Mathews (dolph) wrote :

Is this issue somehow specific to the ubuntu packages?

Revision history for this message
Adam Gandelman (gandelman-a) wrote :

Nothing special in the packaging, the package upgrade process just basically lays out the new code and calls db_sync.

Took a closer look and have had no luck reproducing with current trunk (installed from ppa:openstack-ubuntu-testing/grizzly-trunk-testing), but was able to reproduce reliably using the g3 packages cited in the original bug report. Wondering if this might be a duplicate of Bug #1130424? From what I can tell the fix didn't make it into G3.

Revision history for this message
Dolph Mathews (dolph) wrote :

I believe the bug 1130424 exhibits different symptoms, so I don't think this is a dupe.

I'm wondering if this was caused as a result of a race condition?

Revision history for this message
Adam Gandelman (gandelman-a) wrote :

Fairly certain this is a duplicate. The traceback in the original report is only half the story. Using G3, a db_sync against a populated database first ends with error "AttributeError: 'NamedTuple' object has no attribute 'project_id'" which Bug #1130424 addresses. Subsequent db_sync's after failing once ends with the IntegrityError originally reported. Applying the fix for 1130424 to G3 resolves the issue.

http://paste.ubuntu.com/5611688/

Revision history for this message
Dolph Mathews (dolph) wrote :

Ah, thanks Adam! That explanation makes a lot of sense.

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.