SQLAlchemy: KeyError in cache

Bug #1606547 reported by Julien Danjou
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Gnocchi
Fix Released
High
Mehdi Abaakouk

Bug Description

2016-07-26 01:47:28.684175 | ==============================
2016-07-26 01:47:28.684207 | Failed 1 tests - output below:
2016-07-26 01:47:28.684231 | ==============================
2016-07-26 01:47:28.684241 |
2016-07-26 01:47:28.684283 | gnocchi.tests.test_indexer.TestIndexerDriver.test_resource_type_crud
2016-07-26 01:47:28.684320 | --------------------------------------------------------------------
2016-07-26 01:47:28.684330 |
2016-07-26 01:47:28.684346 | Captured traceback:
2016-07-26 01:47:28.684363 | ~~~~~~~~~~~~~~~~~~~
2016-07-26 01:47:28.684387 | b'Traceback (most recent call last):'
2016-07-26 01:47:28.684444 | b' File "/home/jenkins/workspace/gate-gnocchi-tox-db-py34-postgresql/gnocchi/indexer/sqlalchemy.py", line 138, in get_classes'
2016-07-26 01:47:28.684487 | b' return self._cache[resource_type.tablename]'
2016-07-26 01:47:28.684518 | b"KeyError: 'rt_406715bb24f343468ffd06cc19cc4575'"
2016-07-26 01:47:28.684531 | b''
2016-07-26 01:47:28.684579 | b'During handling of the above exception, another exception occurred:'
2016-07-26 01:47:28.684592 | b''
2016-07-26 01:47:28.684616 | b'Traceback (most recent call last):'
2016-07-26 01:47:28.684674 | b' File "/home/jenkins/workspace/gate-gnocchi-tox-db-py34-postgresql/gnocchi/tests/base.py", line 55, in skip_if_not_implemented'
2016-07-26 01:47:28.684710 | b' return func(*args, **kwargs)'
2016-07-26 01:47:28.684773 | b' File "/home/jenkins/workspace/gate-gnocchi-tox-db-py34-postgresql/gnocchi/tests/test_indexer.py", line 1069, in test_resource_type_crud'
2016-07-26 01:47:28.684805 | b' self.index.delete_resource_type("indexer_test")'
2016-07-26 01:47:28.684864 | b' File "/home/jenkins/workspace/gate-gnocchi-tox-db-py34-postgresql/gnocchi/indexer/sqlalchemy.py", line 470, in delete_resource_type'
2016-07-26 01:47:28.684883 | b' rt, connection)'
2016-07-26 01:47:28.684951 | b' File "/home/jenkins/workspace/gate-gnocchi-tox-db-py34-postgresql/.tox/py34-postgresql/lib/python3.4/site-packages/oslo_db/api.py", line 151, in wrapper'
2016-07-26 01:47:28.684981 | b' ectxt.value = e.inner_exc'
2016-07-26 01:47:28.685053 | b' File "/home/jenkins/workspace/gate-gnocchi-tox-db-py34-postgresql/.tox/py34-postgresql/lib/python3.4/site-packages/oslo_utils/excutils.py", line 220, in __exit__'
2016-07-26 01:47:28.685080 | b' self.force_reraise()'
2016-07-26 01:47:28.685154 | b' File "/home/jenkins/workspace/gate-gnocchi-tox-db-py34-postgresql/.tox/py34-postgresql/lib/python3.4/site-packages/oslo_utils/excutils.py", line 196, in force_reraise'
2016-07-26 01:47:28.685203 | b' six.reraise(self.type_, self.value, self.tb)'
2016-07-26 01:47:28.685270 | b' File "/home/jenkins/workspace/gate-gnocchi-tox-db-py34-postgresql/.tox/py34-postgresql/lib/python3.4/site-packages/six.py", line 686, in reraise'
2016-07-26 01:47:28.685301 | b' raise value'
2016-07-26 01:47:28.685369 | b' File "/home/jenkins/workspace/gate-gnocchi-tox-db-py34-postgresql/.tox/py34-postgresql/lib/python3.4/site-packages/oslo_db/api.py", line 139, in wrapper'
2016-07-26 01:47:28.685392 | b' return f(*args, **kwargs)'
2016-07-26 01:47:28.685453 | b' File "/home/jenkins/workspace/gate-gnocchi-tox-db-py34-postgresql/gnocchi/indexer/sqlalchemy.py", line 188, in unmap_and_delete_tables'
2016-07-26 01:47:28.685481 | b' mappers = self.get_classes(resource_type)'
2016-07-26 01:47:28.685538 | b' File "/home/jenkins/workspace/gate-gnocchi-tox-db-py34-postgresql/gnocchi/indexer/sqlalchemy.py", line 140, in get_classes'
2016-07-26 01:47:28.685569 | b' mapper = self._build_class_mappers(resource_type)'
2016-07-26 01:47:28.685628 | b' File "/home/jenkins/workspace/gate-gnocchi-tox-db-py34-postgresql/gnocchi/indexer/sqlalchemy.py", line 124, in _build_class_mappers'
2016-07-26 01:47:28.685661 | b' {"__tablename__": tablename, "extend_existing": True})'
2016-07-26 01:47:28.685735 | b' File "/home/jenkins/workspace/gate-gnocchi-tox-db-py34-postgresql/.tox/py34-postgresql/lib/python3.4/site-packages/sqlalchemy/ext/declarative/api.py", line 55, in __init__'
2016-07-26 01:47:28.685771 | b' _as_declarative(cls, classname, cls.__dict__)'
2016-07-26 01:47:28.685849 | b' File "/home/jenkins/workspace/gate-gnocchi-tox-db-py34-postgresql/.tox/py34-postgresql/lib/python3.4/site-packages/sqlalchemy/ext/declarative/base.py", line 88, in _as_declarative'
2016-07-26 01:47:28.685891 | b' _MapperConfig.setup_mapping(cls, classname, dict_)'
2016-07-26 01:47:28.685969 | b' File "/home/jenkins/workspace/gate-gnocchi-tox-db-py34-postgresql/.tox/py34-postgresql/lib/python3.4/site-packages/sqlalchemy/ext/declarative/base.py", line 103, in setup_mapping'
2016-07-26 01:47:28.685993 | b' cfg_cls(cls_, classname, dict_)'
2016-07-26 01:47:28.686068 | b' File "/home/jenkins/workspace/gate-gnocchi-tox-db-py34-postgresql/.tox/py34-postgresql/lib/python3.4/site-packages/sqlalchemy/ext/declarative/base.py", line 131, in __init__'
2016-07-26 01:47:28.686089 | b' self._setup_table()'
2016-07-26 01:47:28.686165 | b' File "/home/jenkins/workspace/gate-gnocchi-tox-db-py34-postgresql/.tox/py34-postgresql/lib/python3.4/site-packages/sqlalchemy/ext/declarative/base.py", line 395, in _setup_table'
2016-07-26 01:47:28.686182 | b' **table_kw)'
2016-07-26 01:47:28.686253 | b' File "/home/jenkins/workspace/gate-gnocchi-tox-db-py34-postgresql/.tox/py34-postgresql/lib/python3.4/site-packages/sqlalchemy/sql/schema.py", line 422, in __new__'
2016-07-26 01:47:28.686279 | b' "existing Table object." % key)'
2016-07-26 01:47:28.686369 | b"sqlalchemy.exc.InvalidRequestError: Table 'rt_406715bb24f343468ffd06cc19cc4575' is already defined for this MetaData instance. Specify 'extend_existing=True' to redefine options and columns on an existing Table object."
2016-07-26 01:47:28.686388 | b''
2016-07-26 01:47:28.686399 |

Julien Danjou (jdanjou)
Changed in gnocchi:
importance: Undecided → High
status: New → Triaged
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to gnocchi (master)

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

Changed in gnocchi:
assignee: nobody → Mehdi Abaakouk (sileht)
status: Triaged → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to gnocchi (master)

Reviewed: https://review.openstack.org/347397
Committed: https://git.openstack.org/cgit/openstack/gnocchi/commit/?id=b580c09091d45ca04ce0728b9968eedbeacefbc3
Submitter: Jenkins
Branch: master

commit b580c09091d45ca04ce0728b9968eedbeacefbc3
Author: Mehdi Abaakouk <email address hidden>
Date: Tue Jul 26 15:46:43 2016 +0200

    indexer: put extend_existing in __tables_args__

    extend_existing sqlalchemy table argument that allows to redefine
    an already existing Table() object wasn't set at the right place.

    This change fixes that.

    Change-Id: I9687a07de94186168eb443cf5016dcb28285175e
    Closes-bug: #1606547

Changed in gnocchi:
status: In Progress → Fix Committed
Revision history for this message
Doug Hellmann (doug-hellmann) wrote : Fix included in openstack/gnocchi 2.2.0

This issue was fixed in the openstack/gnocchi 2.2.0 release.

Julien Danjou (jdanjou)
Changed in gnocchi:
milestone: none → 2.2.0
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.