yahoo-eng-team team mailing list archive
-
yahoo-eng-team team
-
Mailing list archive
-
Message #23543
[Bug 1367771] Re: glance-manage db load_metadefs will fail if DB is not empty
Reviewed: https://review.openstack.org/126856
Committed: https://git.openstack.org/cgit/openstack/glance/commit/?id=76c66343a45cba0068c97d1ad21b46c63977e13d
Submitter: Jenkins
Branch: proposed/juno
commit 76c66343a45cba0068c97d1ad21b46c63977e13d
Author: Bartosz Fic <bartosz.fic@xxxxxxxxx>
Date: Tue Oct 7 18:13:51 2014 +0200
Use ID for namespace generated by DB
In current implementation ID that is used in namespace to
insert data to DB is generated by built-in function - enumerate.
This causes problems with loading the metadata when there are already
namespaces in DB.
This patch removes 'enumerate' and asks for namespace ID
generated by database.
Closes-Bug: #1367771
Co-Authored-By: Bartosz Fic <bartosz.fic@xxxxxxxxx>
Co-Authored-By: Pawel Koniszewski <pawel.koniszewski@xxxxxxxxx>
(cherry picked from commit 89c04904416270d3c306d430f443a7127c5fc206)
Conflicts:
glance/db/sqlalchemy/metadata.py
Change-Id: I235c6310077526cafb898ac007c3601b4d66c9fe
** Changed in: glance
Status: Fix Committed => Fix Released
--
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to Glance.
https://bugs.launchpad.net/bugs/1367771
Title:
glance-manage db load_metadefs will fail if DB is not empty
Status in OpenStack Image Registry and Delivery Service (Glance):
Fix Released
Bug description:
To insert data into DB 'glance-manage db load_metadefs' uses IDs for
namespaces which are generated by built-in function in Python -
enumerate:
for namespace_id, json_schema_file in enumerate(json_schema_files,
start=1):
For empty database it works fine, but this causes problems when there
are already metadata namespaces in database. The problem is that when
there are already metadata definitions in DB then every invoke of
glance-manage db load_metadefs leads to IntegrityErrors because of
duplicated IDs.
There are two approaches to fix this:
1. Ask for a namespace just after inserting it. Unfortunately in current implementation we need to do one more query.
2. When this go live - https://review.openstack.org/#/c/120414/ - then we won't need to do another query, because ID is available just after inserting a namespace to DB (namespace.save(session=session)).
To manage notifications about this bug go to:
https://bugs.launchpad.net/glance/+bug/1367771/+subscriptions
References