← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1702445] Re: glance-manage db purge gives DBReferenceError

 

Reviewed:  https://review.opendev.org/c/openstack/glance/+/813691
Committed: https://opendev.org/openstack/glance/commit/360dc45680df0c968994d60f87446e1a93e2d792
Submitter: "Zuul (22348)"
Branch:    master

commit 360dc45680df0c968994d60f87446e1a93e2d792
Author: Mitya_Eremeev <mitossvyaz@xxxxxxx>
Date:   Wed May 4 15:16:29 2022 +0300

    glance-manage can purge all deleted rows
    
    When we want to purge all deleted rows
    we use "glance-manage db purge" or
    "glance-manage purge_images_table"
    then we never know how many deleted rows are still in a table.
    So we need to launch the command many times until
    the command reports that 0 rows were deleted in every table.
    It's inconvenient.
    The patch introduced new valid value for "max_rows".
    If "max_rows" equals -1 all deleted rows are purged.
    
    Closes-Bug: 1702445
    Change-Id: Ia9811d93b1c0b67a1b29a9e8ee3e0fc098c57d4a


** Changed in: glance
       Status: In Progress => 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/1702445

Title:
  glance-manage db purge gives DBReferenceError

Status in Glance:
  Fix Released

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, 6, 4, 7,
  25, 50, 16864), u'param_1': 100}]

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



References