volume_type_projects deleted column is bogus

Bug #1892088 reported by Walt Boring
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Cinder
In Progress
Undecided
Tushar Trambak Gite

Bug Description

The cinder db table volume_type_projects has a 'deleted' column that is declared as an Integer here:
https://github.com/openstack/cinder/blob/master/cinder/db/sqlalchemy/models.py#L446

When the CinderBase model already has a deleted column which is declared as a Boolean here:
https://github.com/openstack/cinder/blob/master/cinder/db/sqlalchemy/models.py#L47

The problem with this is in the DB the deleted column values for the volume_type_projects ends up being the same value as the id column, which increments.

For example:
mysql> select id, deleted_at, deleted from volume_type_projects;
+----+---------------------+---------+
| id | deleted_at | deleted |
+----+---------------------+---------+
| 1 | 2020-08-14 15:52:09 | 1 |
| 2 | 2020-08-14 15:52:09 | 2 |
| 3 | 2020-08-14 15:52:09 | 3 |
+----+---------------------+---------+
3 rows in set (0.00 sec)

Since it's not declared as a Boolean, then it gets the ID value when it's soft deleted. IF we have code that checks for deleted == 1, then this doesn't work.

The column should be declared as Boolean.

Revision history for this message
Walt Boring (walter-boring) wrote :
Changed in cinder:
assignee: nobody → Tushar Trambak Gite (tushargite96)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to cinder (master)

Fix proposed to branch: master
Review: https://review.opendev.org/c/openstack/cinder/+/822821

Changed in cinder:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on cinder (master)

Change abandoned by "Tushar Trambak Gite <email address hidden>" on branch: master
Review: https://review.opendev.org/c/openstack/cinder/+/822821

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.