← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1224429] Re: Don't use ModelBase.save() inside of block session.begin()

 

** Changed in: cinder
       Status: Fix Committed => Fix Released

** Changed in: cinder
    Milestone: None => juno-2

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Compute (nova).
https://bugs.launchpad.net/bugs/1224429

Title:
  Don't use ModelBase.save() inside of block session.begin()

Status in Cinder:
  Fix Released
Status in OpenStack Compute (Nova):
  Fix Released
Status in OpenStack Data Processing (Sahara, ex. Savanna):
  Fix Released

Bug description:
  Current code use ModelBase.save() always submit a commit even inside a block fo with session.begin().
  this is not purpose of using session.begin() to organize some operations  in one transaction

  1)session.begin() will return a SessionTransaction instance, then call SessionTransaction.__enter__()
  and do something in with block, then call SessionTransaction.__exit__(), in method __exit__() will commit or rollback automatically. See https://github.com/zzzeek/sqlalchemy/blob/master/lib/sqlalchemy/orm/session.py#L454

  2) There is also suggestion  metioned in https://github.com/openstack
  /oslo-
  incubator/blob/master/openstack/common/db/sqlalchemy/session.py#L71

  3) ModelBase.save() begin another transaction see
  https://github.com/openstack/oslo-
  incubator/blob/master/openstack/common/db/sqlalchemy/models.py#L47

  so we'd better don't use  ModelBase.save() inside of block
  session.begin()

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