← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1367771] [NEW] glance-manage db load_metadefs will fail if DB is not empty

 

Public bug reported:

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)).

** Affects: glance
     Importance: Undecided
     Assignee: Pawel Koniszewski (pawel-koniszewski)
         Status: In Progress

-- 
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):
  In Progress

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


Follow ups

References