yahoo-eng-team team mailing list archive
-
yahoo-eng-team team
-
Mailing list archive
-
Message #10553
[Bug 1224429] Re: Don't use ModelBase.save() inside of block session.begin()
** Description changed:
-
- Current code use ModelBase.save() always submit a commit even inside a block fo with session.begin().
+ 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
- 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#L451
+ 2) There is also suggestion metioned in https://github.com/openstack
+ /oslo-
+ incubator/blob/master/openstack/common/db/sqlalchemy/session.py#L71
- 2) There is also suggestion metioned in https://github.com/openstack/nova/blob/master/nova/openstack/common/db/sqlalchemy/session.py#L76
-
- 3) ModelBase.save() begin another transaction see https://github.com/openstack/nova/blob/master/nova/openstack/common/db/sqlalchemy/models.py#L51
+ 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()
** Also affects: cinder
Importance: Undecided
Status: New
--
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:
In Progress
Status in OpenStack Compute (Nova):
Fix Released
Status in OpenStack Data Processing (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