Avoid the pattern sql select/delete
Bug #1496586 reported by
Cedric Brandily
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
neutron |
Expired
|
Wishlist
|
Unassigned |
Bug Description
The following pattern:
obj = query.filter(
context.
is racy because obj can be deleted between the select and the delete, we should prefer when possible the pattern:
count = query.filter(
if not count:
raise NotFound
Changed in neutron: | |
importance: | Undecided → Wishlist |
status: | New → Confirmed |
To post a comment you must log in.
This can't be applied everywhere blindly:
http:// eavesdrop. openstack. org/irclogs/ %23openstack- neutron/ %23openstack- neutron. 2015-09- 16.log. html#t2015- 09-16T22: 52:04
So it's good to have a look around, but let's not start a crusade :)