← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1702445] [NEW] glance-manage db purge gives DBReferenceError

 

Public bug reported:

Assume that 'image' table has 1 record and 120 image tags are added to a
image. When you purge the db passing default parameters, it will give
‘IntegrityError’ error.

Steps to reproduce:

1. glance-manage db purge age_in days=30, max_rows=100

2. As per above command, max 100 records get purge from image_tags table

3. It fails with the below error when it tries to purge record from
image table having reference in image_tags table because 20 records of
image_tags still exists.

DBError detected when purging from images: (pymysql.err.IntegrityError)
(1451, u'Cannot delete or update a parent row: a foreign key constraint
fails (`glance`.`image_tags`, CONSTRAINT `image_tags_ibfk_1` FOREIGN KEY
(`image_id`) REFERENCES `images` (`id`))') [SQL: u'DELETE FROM images
WHERE images.id in (SELECT T1.id FROM (SELECT images.id \nFROM images
\nWHERE images.deleted_at < %(deleted_at_1)s ORDER BY images.deleted_at
\n LIMIT %(param_1)s) as T1)'] [parameters: {u'deleted_at_1':
datetime.datetime(2017, 7, 4, 7, 25, 50, 16864), u'param_1': 1}]

** Affects: glance
     Importance: Undecided
     Assignee: Pooja Jadhav (poojajadhav)
         Status: New

** Changed in: glance
     Assignee: (unassigned) => Pooja Jadhav (poojajadhav)

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to Glance.
https://bugs.launchpad.net/bugs/1702445

Title:
  glance-manage db purge gives DBReferenceError

Status in Glance:
  New

Bug description:
  Assume that 'image' table has 1 record and 120 image tags are added to
  a image. When you purge the db passing default parameters, it will
  give ‘IntegrityError’ error.

  Steps to reproduce:

  1. glance-manage db purge age_in days=30, max_rows=100

  2. As per above command, max 100 records get purge from image_tags
  table

  3. It fails with the below error when it tries to purge record from
  image table having reference in image_tags table because 20 records of
  image_tags still exists.

  DBError detected when purging from images:
  (pymysql.err.IntegrityError) (1451, u'Cannot delete or update a parent
  row: a foreign key constraint fails (`glance`.`image_tags`, CONSTRAINT
  `image_tags_ibfk_1` FOREIGN KEY (`image_id`) REFERENCES `images`
  (`id`))') [SQL: u'DELETE FROM images WHERE images.id in (SELECT T1.id
  FROM (SELECT images.id \nFROM images \nWHERE images.deleted_at <
  %(deleted_at_1)s ORDER BY images.deleted_at \n LIMIT %(param_1)s) as
  T1)'] [parameters: {u'deleted_at_1': datetime.datetime(2017, 7, 4, 7,
  25, 50, 16864), u'param_1': 1}]

To manage notifications about this bug go to:
https://bugs.launchpad.net/glance/+bug/1702445/+subscriptions


Follow ups