Reuse the deleted image-member before create a new one
Use only one record to maintain the member-ship between a pair of image and
tenant. When create a new image-member, at first check all existing
image-member records including the deleted image-member, then update it if it
exists, otherwise, create a new one.
Blueprint information
- Status:
- Complete
- Approver:
- Nikhil Komawar
- Priority:
- Medium
- Drafter:
- Long Quan Sha
- Direction:
- Approved
- Assignee:
- Long Quan Sha
- Definition:
- Approved
- Series goal:
- Accepted for liberty
- Implementation:
- Implemented
- Milestone target:
- 11.0.0
- Started by
- Long Quan Sha
- Completed by
- Nikhil Komawar
Related branches
Sprints
Whiteboard
If glance backend database is not MySQL or postgreSQL, the unique constraint of image-member only includes image-id and member. In this case, if an image-member is deleted, then create it again with the same parameters, glance initiates a query to see if there is already an existing one, but the result doesn't include the record which was marked as deleted, glance will try to create a new one with the same parameters, then it will fail with duplicate error.
Unify the unique constraint for image-member like we did for MySQL and postgreSQL in 022_image_
restricted than MySQL. The columns under unique constrains should be "NOT NULL", otherwise, an error occurs. Thus, we can't create the same unique constraint for this kinds of database.
We would alter "deleted_at" column to "not nullable" in migration. That means we have to insert a default timestamp value for the new created image-member, an active member with a no-blank timestamp for "deleted_at" would confuse user.
So I propose change : Use only one record to maintain the member-ship between a pair of image and tenant. When create a new image-member, at first check all existing image-member records including the deleted image-member, then update it if it exists, otherwise, create a new one.
Addressed by: https:/
Gerrit topic: https:/
Addressed by: https:/
reuse the deleted image-member before create a new image-member
Spec for blueprint: https:/
Gerrit topic: https:/
Addressed by: https:/
reuse the deleted image-member before create a new image-member