test_postgresql_opportunistically fails on RHEL

Bug #1160114 reported by Dan Prince
14
This bug affects 4 people
Affects Status Importance Assigned to Milestone
Glance
Fix Released
High
Eoghan Glynn
Grizzly
Fix Released
High
Eoghan Glynn

Bug Description

Using the latest version of Glance grizzly I'm seeing the following when running unit tests on RHEL (with postgres):

======================================================================
ERROR: glance.tests.unit.test_migrations.TestMigrations.test_postgresql_opportunistically
----------------------------------------------------------------------
_StringException: Traceback (most recent call last):
  File "/home/dprince/glance/glance/tests/unit/test_migrations.py", line 292, in test_postgresql_opportunistically
    self._walk_versions(engine, False, False)
  File "/home/dprince/glance/glance/tests/unit/test_migrations.py", line 319, in _walk_versions
    self._migrate_up(engine, version, with_data=True)
  File "/home/dprince/glance/glance/tests/unit/test_migrations.py", line 359, in _migrate_up
    version)
  File "/home/dprince/glance/.venv/lib/python2.6/site-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 "/home/dprince/glance/.venv/lib/python2.6/site-packages/migrate/versioning/util/__init__.py", line 159, in with_engine
    return f(*a, **kw)
  File "/home/dprince/glance/.venv/lib/python2.6/site-packages/migrate/versioning/api.py", line 366, in _migrate
    schema.runchange(ver, change, changeset.step)
  File "/home/dprince/glance/.venv/lib/python2.6/site-packages/migrate/versioning/schema.py", line 91, in runchange
    change.run(self.engine, step)
  File "/home/dprince/glance/.venv/lib/python2.6/site-packages/migrate/versioning/script/py.py", line 145, in run
    script_func(engine)
  File "/home/dprince/glance/glance/db/sqlalchemy/migrate_repo/versions/022_image_member_index.py", line 33, in upgrade
    table=image_members).drop()
  File "/home/dprince/glance/.venv/lib/python2.6/site-packages/migrate/changeset/constraint.py", line 59, in drop
    self.__do_imports('constraintdropper', *a, **kw)
  File "/home/dprince/glance/.venv/lib/python2.6/site-packages/migrate/changeset/constraint.py", line 32, in __do_imports
    run_single_visitor(engine, visitorcallable, self, *a, **kw)
  File "/home/dprince/glance/.venv/lib/python2.6/site-packages/migrate/changeset/databases/visitor.py", line 75, in run_single_visitor
    fn(element, **kwargs)
  File "/home/dprince/glance/.venv/lib/python2.6/site-packages/migrate/changeset/ansisql.py", line 272, in visit_migrate_unique_constraint
    self._visit_constraint(*p, **k)
  File "/home/dprince/glance/.venv/lib/python2.6/site-packages/migrate/changeset/ansisql.py", line 284, in _visit_constraint
    self.execute()
  File "/home/dprince/glance/.venv/lib/python2.6/site-packages/migrate/changeset/ansisql.py", line 42, in execute
    return self.connection.execute(self.buffer.getvalue())
  File "/home/dprince/glance/.venv/lib/python2.6/site-packages/sqlalchemy/engine/base.py", line 1449, in execute
    params)
  File "/home/dprince/glance/.venv/lib/python2.6/site-packages/sqlalchemy/engine/base.py", line 1628, in _execute_text
    statement, parameters
  File "/home/dprince/glance/.venv/lib/python2.6/site-packages/sqlalchemy/engine/base.py", line 1698, in _execute_context
    context)
  File "/home/dprince/glance/.venv/lib/python2.6/site-packages/sqlalchemy/engine/base.py", line 1691, in _execute_context
    context)
  File "/home/dprince/glance/.venv/lib/python2.6/site-packages/sqlalchemy/engine/default.py", line 331, in do_execute
    cursor.execute(statement, parameters)
ProgrammingError: (ProgrammingError) constraint "image_members_image_id_member_key" of relation "image_members" does not exist
 'ALTER TABLE image_members DROP CONSTRAINT image_members_image_id_member_key ' {}

Dan Prince (dan-prince)
Changed in glance:
assignee: nobody → Dan Prince (dan-prince)
importance: Undecided → High
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to glance (master)

Fix proposed to branch: master
Review: https://review.openstack.org/25351

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Fix proposed to branch: master
Review: https://review.openstack.org/25352

tags: added: grizzly-rc-potential
Revision history for this message
Eoghan Glynn (eglynn) wrote :

As noted on https://review.openstack.org/25352 ...

Unfortunately this will break a 21->22 upgrade on Fedora where the version of PostgreSQL installed:

  $ rpm -qa | grep postgresql-server
  postgresql-server-9.2.3-1.fc18.x86_64

which uses the unique constraint naming convention that I encoded in the initial version of this migration (as I tested against postgres on F18 as opposed to RHEL).

I'll need to come up with another way of inferring the original unique constraint name.

Changed in glance:
assignee: Dan Prince (dan-prince) → Eoghan Glynn (eglynn)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Fix proposed to branch: master
Review: https://review.openstack.org/25515

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to glance (milestone-proposed)

Fix proposed to branch: milestone-proposed
Review: https://review.openstack.org/25634

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to glance (master)

Reviewed: https://review.openstack.org/25515
Committed: http://github.com/openstack/glance/commit/e9079d0fd5b4219b7eeacc89090758bf78a81d4f
Submitter: Jenkins
Branch: master

commit e9079d0fd5b4219b7eeacc89090758bf78a81d4f
Author: Eoghan Glynn <email address hidden>
Date: Wed Mar 27 12:17:28 2013 +0000

    Fallback to inferring image_members unique constraint name

    Fixes bug 1160114

    The initial version of the 022_image_member_index migration
    hardcoded the default naming convention for unqiue constraints
    used by PostgreSQL 9.2, which turns out to different to the
    convention used by PostgreSQL 8.4. This causes the CI to fail
    (non-voting) against RHEL.

    We resolve the issue by falling back to inferring the existing
    unique constraint name from the image_members indices.

    Change-Id: Iad6db033e63cdfd7a77db44bdeaed2284699b469

Changed in glance:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in glance:
milestone: none → grizzly-rc2
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to glance (milestone-proposed)

Reviewed: https://review.openstack.org/25634
Committed: http://github.com/openstack/glance/commit/b5757246b00c23523b5e2b829435aebf1ee9c000
Submitter: Jenkins
Branch: milestone-proposed

commit b5757246b00c23523b5e2b829435aebf1ee9c000
Author: Eoghan Glynn <email address hidden>
Date: Wed Mar 27 12:17:28 2013 +0000

    Fallback to inferring image_members unique constraint name

    Fixes bug 1160114

    The initial version of the 022_image_member_index migration
    hardcoded the default naming convention for unqiue constraints
    used by PostgreSQL 9.2, which turns out to different to the
    convention used by PostgreSQL 8.4. This causes the CI to fail
    (non-voting) against RHEL.

    We resolve the issue by falling back to inferring the existing
    unique constraint name from the image_members indices.

    Change-Id: Iad6db033e63cdfd7a77db44bdeaed2284699b469

Changed in glance:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.