← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1496586] [NEW] Avoid the pattern sql select/delete

 

Public bug reported:

The following pattern:

 obj = query.filter(...).one()
 context.session.delete(obj)

 is racy because obj can be deleted between the select and the delete,
we should prefer when possible the pattern:

 count = query.filter(...).delete(synchronize_session=False)
 if not count:
   raise NotFound

** Affects: neutron
     Importance: Undecided
     Assignee: Cedric Brandily (cbrandily)
         Status: New


** Tags: db

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

Title:
  Avoid the pattern sql select/delete

Status in neutron:
  New

Bug description:
  The following pattern:

   obj = query.filter(...).one()
   context.session.delete(obj)

   is racy because obj can be deleted between the select and the delete,
  we should prefer when possible the pattern:

   count = query.filter(...).delete(synchronize_session=False)
   if not count:
     raise NotFound

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


Follow ups